Our state of the art Gantt chart


Post by methode »

Hello,

I got a new bug with realease 2020-05-31. The code works fine before this update.

The error is: gantt.module.js:13366 Uncaught (in promise) TypeError: Cannot read property 'id' of undefined

Please, see screenshots attached.
I'm working with bryntum-angular-shared, importing from bryntum and not UMD files.

autoSync is set to true.

Steps to reproduce:

  • open task in edit
  • add new resource, click save
  • double click the saved task
  • check the js console

Can you reproduce it?

Thank you

Attachments
print-002.png
print-002.png (172.11 KiB) Viewed 2132 times
print-001.png
print-001.png (106.36 KiB) Viewed 2132 times

Post by pmiklashevich »

Hello,

I've checked the issue in both Advanced demo (with no wrapper) and TaskEditor demo (with wrapper) and I've seen no errors. I replaced 'bryntum-gantt/gantt.umd.js' with 'bryntum-gantt' in:
Gantt/examples/angular/_shared/projects/bryntum-angular-shared/src
Gantt/examples/angular/advanced/src
Gantt/examples/angular/taskeditor/src
And built both examples with "npm i" and "npm run start"

Here you can see how it works in Advanced demo:

Запись активности на экране 2020-06-03 в 12.00.52.gif
Запись активности на экране 2020-06-03 в 12.00.52.gif (4.87 MiB) Viewed 2121 times

Could you please check out the latest release build and confirm if it works for you or not. If not, please let us know how to reproduce with one of our demos or attach a runnable testcase. Thanks!

Best,
Pavel

Pavlo Miklashevych
Sr. Frontend Developer


Post by methode »

Hi Pavel,

ok I will try with the new release code asap, and let you know.

Thanks


Post by methode »

Hello Pavel,

here I am with an update on topic.

I have no clue of the cause of the error. In previous versions I had no issues, my code has not changed.

I dived into the gantt.module.js file of the build folder. Collection class, splice method.

Since console gave me "id poperty of undefined" I solved with a trivial check of the: values[removeIndex]

So the code becomes:


...

if (typeof toRemove === 'number') {
        for (let removeIndex = index; toRemove; --toRemove) {
          if(values[removeIndex]){ // ---------> MY CODE HERE
            const id = safeIndexKey(values[removeIndex][idProperty]); // If the entry here is being replaced, skip the insertion index past it

        if (newIds[id]) {
          index++;
          removeIndex++;
        } // If the id is not among incoming items, remove it
        else {
            removed.push(values[removeIndex]);
            values.splice(removeIndex, 1);
            me._indicesInvalid = mutated = true;
          }
      }
    }
  }

 ...
 

This is the only way I found in order to make code working.

I set a console.log inside the for loop and saw it is executed many times, don't know if it's ok or not.

Now, what do you think? How can I persist the code change?
Since the code is inside the build folder, do I need to change the code - at every new - release download?
How can I solve it?

Thanks a lot


Post by pmiklashevich »

You shouldn't modify our sources. Please upload a testcase so we can investigate and fix the problem properly. Thanks!

Pavlo Miklashevych
Sr. Frontend Developer


Post by methode »

Hello Pavel,

yep, issue's still there despite the update.

May I know? In the test you made, with wrapper, did you try the autoSync: true property?

In the meanwhile, I'll try to reproduce a test case. Not so immediate, it will take a bit of time.
One more thing and info I noticed is that code works fine, no errors, if I add resources inline directly from the Grid.

Thank you


Post by saki »

To test the issue I have done the following in taskeditor demo:

  1. I have downloaded gantt-2020-06-06-release nightly

  2. I have configured the project as follows:

    const project = new ProjectModel({
        autoSync : true,
        transport : {
            load : {
                url : 'assets/data/launch-saas.json'
            },
            sync : {
                url : 'assets/data/success.json',
                method : 'GET'
            }
        },
        autoLoad  : true
    })
  3. Content of success.json is:

    {
      "success":true
    }

I was not able to reproduce the issue. Gantt sends the requests on each save with no errors.

Please confirm that you are still getting the error when you try the above steps.


Post by methode »

Hello Saki,

ok, I'll set code like above and let you know asap.

Thanks


Post by mats »

@methode: Any update?


Post by methode »

Hello,

yes, I'm working on the issue, difficult to discover the cause.
I can confirm that the code above by Saki works. And confirm that there was no issue before release update.

I have to check with my data server side - BUT - since adding resources from grid has no issues, I have to discover why I get error from the task editor. For the moment, I don't think the issue is on the response from my API.

I'll update on that asap, please consider the project is a NET Core 3 Angular project not so easy to simplify.

One more thing, I'm working with Angular 9.

Thank you


Post Reply