Premium support for our pure JavaScript UI components


Post by jzarzeckis »

I have a react app, and right now I'm passing the state of the app via the events prop. However when I get new data from the backend, and the component receives new events in the same prop, very often the events get lost, and I only see them when removing and rerendering the component with the same state.

In big data example I see that a different prop - project.eventStore.data is being used to pass the events, but I also see it being used together with suspendRefresh() and then resumeRefresh(true) - but that's not very declarative, and easy to replicate in a react-app.

What is the suggested approach to update events, if they come from app state, and get updated dynamically?


Post by mats »

Settings 'events' should do the trick. Any chance you can upload a small test case showing your issue? Can you replicate it in our samples? What version are you on?


Post by saki »

You can just bind events property to the state. For example:

<BryntumScheduler events={this.state.events} />

Post by jzarzeckis »

:( That's exactly what I already have. And it fails miserably, when this.state.events are updated to new state.

And it will require a lot of work to prepare a good test-case for you.

Any chance there's a function that will force recalculation of the event store, to sort this out?


Post by jzarzeckis »

Also - it's not like it reproduces 100% of the cases. Sometimes it does work as expected - but most of the time - majority of the events get lost somewhere. As if there's something wrong with memoization in the event store or something?


Post by jzarzeckis »

I'm on version 4.1.0-beta-3


Post by alex.l »

Hi jzarzeckis,

Sorry to hear you have problems with setting your data.
We have a bug with applying data on filtered store, please check here: https://github.com/bryntum/support/issues/2540
If you don't use filters, we should be able to reproduce this to figure out and fix. The way you set events is correct and should work. It works ok in our examples so I cannot reproduce it. I guess you have some extra steps that we missed so could you please try to modify our examples or simplify your app and attach it here? It will give us opportunity to help you with that problem.

All the best,
Alex

All the best,
Alex


Post by jzarzeckis »

As I said - even replaying the same scenario - the issue doesn't reproduce on 100% of the cases. But it does happen randomly on updating the data.

Could you at least for now suggest - what is the correct function to call to force recalculation/rerendering of the event store?

If I'll be able to narrow down the exact scenario to reproduce this, I'll let you know.


Post by alex.l »

Hi jzarzeckis,

Actually, https://bryntum.com/docs/scheduler-pro/#SchedulerPro/model/ProjectModel#function-commitAsync should do all required recalculations. But in your case there is a bug which we actually were not able to completely reproduce.
For now you could follow the approach you described in your first post - use https://bryntum.com/docs/scheduler-pro/#SchedulerPro/data/EventStore#function-loadDataAsync method to set the data.

All the best,
Alex

All the best,
Alex


Post Reply