Our pure JavaScript Scheduler component


Post by coen »

Hi,

I have implemented the vertical mode of the scheduler and encountered an issue when switching between view presets. In my project, I use React, but I have been able to reproduce it using the regular JavaScript version on the bryntum website as well.

My issue is as follows:

  1. Start the vertical view in anything but a day view (e.g., week, month, etc.).
  2. Switch to a day view.
  3. A null pointer will occur (same line of code as: error-bryntumcom-example.png)

When you debug this, you'll notice that the rows will go above the resources "header," and a different calculation to account for this will be triggered. It's this calculation that gives a null pointer exception (see: error-bryntumcom-example.png).

Notes:

  • In my React app: The error doesn't occur when you start on a day view but will occur if you switch from this view to another view and then back to a day view.
  • In the example: The error doesn't occur every time but comes up only after using it for a while (not sure why precisely).

Error recreation
I have been able to recreate the error by adding the view switching logic from the configuration example to the vertical view example (just to keep it as vanilla as possible).

Another issue you'll notice is that the time axis on the right can get "stuck" when switching presets (see stuck-on-switch-preset.png). Usually this will correct itself after a you switch a few times between different presets.

Hope you can help me out with this one, and thanks!

Regards,

Coen

Attachments
example.js
(11.45 KiB) Downloaded 17 times
stuck-on-switch-preset.png
stuck-on-switch-preset.png (52.23 KiB) Viewed 359 times
error-bryntumcom-example.png
error-bryntumcom-example.png (94.78 KiB) Viewed 359 times

Post by coen »

Btw, this is the line of code that will be null and cause the null pointer down the line:

// Dates in view + buffer
  get dateRange() {
    const {
      scheduler
    } = this;
    let bottomDate = scheduler.getDateFromCoordinate(Math.min(scheduler.scrollTop + scheduler.bodyHeight + scheduler.tickSize - 1, (scheduler.virtualScrollHeight || scheduler.scrollable.scrollHeight) - 1));
    // Might end up below time axis (out of ticks)
    if (!bottomDate) {
      bottomDate = scheduler.timeAxis.last.endDate;
    }
    let topDate = scheduler.getDateFromCoordinate(Math.max(scheduler.scrollTop - scheduler.tickSize, 0));
    // Might end up above time axis when reconfiguring (since this happens as part of rendering)
    if (!topDate) {
      topDate = scheduler.timeAxis.first.startDate;
      // >>>>>>>>>>>> CAUSING THE NULL POINTER <<<<<<<<<<<<<
      bottomDate = scheduler.getDateFromCoordinate(scheduler.bodyHeight + scheduler.tickSize - 1);
    }
    return {
      topDate,
      bottomDate
    };
  }

Post by alex.l »

Hi coen,

I see it's working well in the code you attached.
The only change I did, I changed default viewPreset to "weekAndMonth" as you suggested. After load the app, I changed preset to "Days" using viewpresetcombo on tbar. I see no errors.

Please make sure you used latest released version and let us know if something else required to reproduce the problem.

Thank you!

All the best,
Alex


Post by coen »

Hi Alex,

Thanks for your reply.

To clarify: the first part of my bug report mentions the issue I have in my react application. This is not exactly the same as how the error is triggered in the Bryntum.com example I provided. However, the error occurs on the exact same line and with a similar action (changing the view preset however not as a react prop). It's quite difficult to reproduce with the Bryntum.com example but it can be done. I've added a screenshot of this with the example.js code (full-example-error-screenshot.png).

As for the timeaxis issue I've added a video of what I mean in action (stuck-time-axis.webm). You'll see the first time this occurs on 00:12.

Attachments
full-example-error-screenshot.png
full-example-error-screenshot.png (512.98 KiB) Viewed 331 times
view-is-stuck.webm
(2.14 MiB) Downloaded 17 times

Post by alex.l »

Thanks. I was able to reproduce rendering error as in the ticket https://github.com/bryntum/support/issues/6886
Does it that your were faced with?

All the best,
Alex


Post by coen »

Thanks Alex, yes, this is one of the issues I found. Glad to hear you where able to reproduce it. As for the other issue, have you been able to reproduce the null pointer error on the .getTime (see second post for details) as well? It is pretty hard to reproduce in the example on the bryntum site as it doesn't occur very often and I'm not sure what combination of events leads to this error. However, in the react application it always occurs (details can be found in my original post). Could I provide you with anything else to help you reproduce this error?


Post by alex.l »

The issue with .getTime() was just fixed and will be available in next patch release, here is the ticket https://github.com/bryntum/support/issues/6876

All the best,
Alex


Post by coen »

Ahh, great, thanks again!


Post by alex.l »

All the best,
Alex


Post by coen »

Hi Alex, just wondering if you have a release date planned for 5.3.7?


Post Reply