We're manually loading assignments, events and resources, depending on the current timeAxis start and end.
Sometimes this would lead to assignment store catching a "remove" action, when the new dataset is empty, which is not desirable, since we're basically dealing with a dataset operation.
The point is:
1) why suspend events doesn't work as expected and still triggers dataset in your example with the code attached, on the multiple assignments?
2) why triggering assignments remove when the dataset was in fact loaded with an empty array? how can we workaround this? Because we need to catch the assignments that were removed, like when unassigning.
1) why suspend events doesn't work as expected and still triggers dataset in your example with the code attached, on the multiple assignments?
This might be considered a bug, we'll discuss.
why triggering assignments remove when the dataset was in fact loaded with an empty array? how can we workaround this? Because we need to catch the assignments that were removed, like when unassigning.
I don't see 'remove' event fired, just 'dataset' which is expected since a new array was set.
Maybe some timing issue, here's the console log of the remove, followed by dataset.
Evidence - remove followed by dataset.PNG (103.86 KiB) Viewed 1259 times
So, what is the recommended approach for reloading stores? I guess we're not the only ones doing this.
This is a major issue for us since it might wipe out all the existing assignments when moving to a different timespan and the new timespan doesn't have any...
-The "remove" action is triggered on the assignment store
-We save assignment whenever the assignment store is changed (except on the dataset action). We also save the removed assignments.
-If this remove is triggered when assigning an empty dataset, we don't know if it's a "Unassign". From what we know, we don't have a way to distinguish between those two.
If this remove is triggered when assigning an empty dataset, we don't know if it's a "Unassign". From what we know, we don't have a way to distinguish between those two.
Changing data in stores is async. Please check: https://bryntum.com/docs/scheduler/#Scheduler/data/AssignmentStore
So events happen after you called scheduler.resumeEvents();. This is why you don't see them if you used commented line setTimeout( () => scheduler.resumeEvents(), 2000);.
There is no difference via remove assignment and unassign.
Thanks for the update. Makes sense. Until the latest 4.0.8 version, we used this setTimout of 300ms as a workaround, because we were setting all the properties on scheduler synchronously and it was working. Has any change been introduced lately?
This operation was async before 4.0.8 too, and you were need to use timeout anyway. It's hard to say why 300ms was enough and now it's not enough, too many possible options.