Our pure JavaScript Scheduler component


Post by johan.isaksson »

I tried changing the "tree" demo to this, which seems fine:

import '../_shared/shared.js'; // not required, our example styling etc.
import SchedulerPro from '../../lib/SchedulerPro/view/SchedulerPro.js';
import '../../lib/Grid/feature/Tree.js';
import SchedulerProResourceModel from '../../lib/SchedulerPro/model/ResourceModel.js';

class Gate extends SchedulerProResourceModel {
    static get fields() {
        return [{
            name : 'capacity',
            type : 'number'
        }];
    }
}

new SchedulerPro({
    adopt : 'container',

    features : {
        tree : true
    },

    columns : [
        {
            type  : 'tree',
            text  : 'Name',
            width : 220,
            field : 'name'
        }
    ],

    startDate  : new Date(2017, 11, 2, 8),
    viewPreset : 'hourAndDay',

    project : {
        autoLoad : true,

        resourceStore : {
            tree       : true,
            modelClass : Gate
        },

        transport : {
            load : {
                url : 'data/data.json'
            }
        }
    }
});
````

Great if you can supply your dataset & models
Best regards,
Johan Isaksson

Post by support@bright »

We've found the workaround for the batch operations:

 useAsync(async () => {
    if (currentEventStore && currentDependencyStore) {
      const data = values(cloneDeep(eventsInTeams));
      const depData = values(cloneDeep(dependenciesInTeams));

  currentEventStore.beginBatch();
  currentDependencyStore.beginBatch();

  currentEventStore.data = data;
  currentDependencyStore.data = depData;

  setOriginalEvents(data);
  setOriginalDependencies(depData);

  const result = await currentScheduler.project.commitAsync();

  currentEventStore.endBatch();
  currentDependencyStore.endBatch();

  return result;
}
  }, [eventsInTeams, currentEventStore, dependenciesInTeams, currentDependencyStore]);

Can it cause any side-effects?

Do you need my models and dataset to work on the issue? It's not a problem, just a matter of time - the deadline for my current milestone is pretty soon :)

Best,
Alex


Post by johan.isaksson »

Hi

Don’t think there will be side effects, if it rendered it should be fine. Should not need to be that complicated though. If I am to debug it I need models and data, but if you are happy with your workaround then it is up to you :)

Best regards,
Johan Isaksson

Post by support@bright »

Hi there is my runnable app if it still can be useful
https://www.dropbox.com/s/6gr3fgnen5arbvb/smartservice-spa-runnable_1599826082080.zip?dl=0
move events in "All steps" resources

Sorry for the long answer, it's because of the very tough deadlines on my project.

Best,
Alex


Post by johan.isaksson »

Thanks for sharing, aim to take a look next week if I can spot the problem

Best regards,
Johan Isaksson

Post by support@bright »

Hi! I've got some news :)

  1. I've updated the scheduler to rc1
  2. I've implemented the same data loading approach and order as in the Big dataset example except for the assignment store - I could not get events rendered in the scheduler (probably because of tree)
  3. So the only difference between Big dataset example implementation and my implementation is I use the tree feature
  4. The problem is it takes about 5 seconds to load 4000 events in the example but about 16 seconds in my app. You can see time logging in the console. Could you please take a look at the runnable demo (link below) - what can I do wrong?

https://www.dropbox.com/s/cstk4vr1656bemf/smartservice-spa-runnable_1602252714930.zip?dl=0

Last edited by support@bright on Tue Oct 13, 2020 7:44 am, edited 1 time in total.

Best,
Alex


Post by support@bright »

See README to launch and SchedulerByTeams.tsx:45

Best,
Alex


Post by alex.l »

Hi Alex,

Thank you for providing the test case. After the review I've found that useAsync method in your SchedulerByTeams.tsx file called 4 times during initialization. In that method you used:

currentEventStore.data = data;
currentDependencyStore.data = depData;

This means you re-apply data 4 times.

Also, startDate that your scheduler has been initialized with - is a current date, which has no data to display. I changed the code a bit, but still had no chance to repro that 16 seconds delay you mentioned. Btw, 16 seconds that you mentioned divided on 4 times re-init I mentioned will be 5 seconds that our bigdataset example takes for you to show 4000 events. But for me it still takes about 1 second.

It will be appreciated if you check if useAsync is the best place to set data, after that change your code to make possible repro the issue without need to edit source code and came back with it, if the issue still exists. I will be able continue investigation and I am sure, we will find the problem.

I used 4.0.0-rc-2 for debugging.

All best,
Alex

All the best,
Alex


Post by support@bright »

Hey Alex,

Thank you for your quick reply. But I am not sure we have

currentEventStore.data = data;

in our latest test case.
Here is the direct link to the code file https://www.dropbox.com/s/cstk4vr1656bemf/smartservice-spa-runnable_1602252714930.zip?dl=0&file_subpath=%2Fsmartservice-spa-runnable%2Fsrc%2Fcomponents%2FScheduler%2Fcomponents%2FSchedulerByTeams.tsx
I've checked it once more time there are no 4 times re-applying

Best,
Alex


Post by alex.l »

Hi Alex,

I downloaded your app once again and see it's updated. I was able to repro that issue with our examples. Here is a ticket: https://github.com/bryntum/support/issues/1681

Looks like it happens only in React apps, but works fast without it. We will check what is going on.
Thanks for the report!

All best,
Alex.

All the best,
Alex


Post Reply