Our pure JavaScript Scheduler component


Post by kirans »

I'm seeing an error below when in vertical mode with 3.1.7 (earlier version 3.1.5 was used, but veritical mode was not working). Is there anything I need to correct to make it work? Horizontal version has not error.

vue.esm.js?a026:1897 TypeError: Cannot read property 'on' of undefined
at ResourceHeader.set (scheduler.module.js?7d42:112300)
at VerticalEventMapper.set (scheduler.module.js?7d42:111020)
at VerticalEventMapper.onChangeResourceStore (scheduler.module.js?7d42:111046)
at Scheduler.trigger (scheduler.module.js?7d42:3386)
at eval (scheduler.module.js?7d42:3399)
at Array.forEach (<anonymous>)
at ResourceStore.trigger (scheduler.module.js?7d42:3399)
at ResourceStore.loadData (scheduler.module.js?7d42:34014)
at ResourceStore.set (scheduler.module.js?7d42:33902)
at Scheduler.set (scheduler.module.js?7d42:106603)


Post by alex.l »

Hi kirans,

I just downloaded Scheduler 3.1.7 from CustomerZone and checked on our "advanced" Vue example. All works as expected. Could you please give us more details - where do you see this problem and try to reproduce it with one of our examples? I would recommend you to make sure you are up to date with all sources, because this problem has been fixed in 3.1.6 (https://github.com/bryntum/support/issues/1005)

All best,
Alex

All the best,
Alex


Post by kirans »

Thanks for the tip Alex. Yes there was a file that was not updated to 3.1.7. With that fixed, the original issue was gone. There was new JS error but that was because scheduler.schedulerEngine needs to be changed to scheduler.schedulerInstance. Change log said it was deprecated. But scheduler.schedulerEngine seems actually removed.
Issue we reported in OP is fixed.


Post by Maxim Gorkovsky »

We will look into the changelog issue, thank you for report.
As I understand you replaced schedulerEngine with schedulerInstance and everything works for you?


Post by saki »

schedulerEngine has been moved to computed to continue its functionality plus console warn about deprecation. The wrapper's code is now:

        computed : {
            /**
             * @deprecated in favor of schedulerInstance
             */
            schedulerEngine() {
                console.warn('schedulerEngine is deprecated. Use schedulerInstance instead.')
                return this.schedulerInstance;
            }
        }

I have tested it using our Vue Animations demo in App.vue function maxHandler where I changed schedulerInstance to the deprecated schedulerEngine and the example continued to work but the deprecation message.

If it gives you an error post please a test case so that we can debug and fix it.


Post by kirans »

I can provide an approximate repro case:
I've used Vuestic as our app is similar to it. To repro:

  1. create a method:

     test() {
                    const engine = this.$refs.scheduler.schedulerEngine;
                    console.log("TEST METHOD");
                    if(engine) {
                        engine.refresh();
                         }
                }
                
  2. in created() call the test method.
    this.test();

  3. Reload the page.

    TypeError: Cannot read property 'schedulerEngine' of undefined
        at VueComponent.test(SchedulerTab.vue?569f:142)
        at VueComponent.created (SchedulerTab.vue?569f:192)
        at invokeWithErrorHandling (vue.esm.js?a026:1863)
        at callHook (vue.esm.js?a026:4228)
        at VueComponent.Vue._init (vue.esm.js?a026:5017)
        at new VueComponent (vue.esm.js?a026:5163)
        at createComponentInstanceForVnode (vue.esm.js?a026:3292)
        at init (vue.esm.js?a026:3123)
        at createComponent (vue.esm.js?a026:5989)
        at createElm (vue.esm.js?a026:5936)
    

In our app, replacing with scheduler.schedulerInstance solves the issues. But in example above, it does not get solved. This might partly be Vue sequence of init.

We don't expect to get a resolution as we are not blocked. Its just a good to know what the solution is.


Post by saki »

Yes, timing is the clincher. Scheduler, doesn't matter if we call it schedulerEngine or schedulerInstance, is created in mounted() method of the wrapper so created() is just too early and the instance does not exist at the time.


Post Reply