Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I preload month data? #196

Open
achillelrc opened this issue Sep 29, 2017 · 3 comments
Open

Can I preload month data? #196

achillelrc opened this issue Sep 29, 2017 · 3 comments

Comments

@achillelrc
Copy link

Hello!
I use your calendar and I was wondering if it is possible to preload data.
I mean when i scroll to the left or to the right the events doesn't appear directly there is a little latency and the data pops up.
1 2
For exemple here when I swipe i can still see the event in the september month but the events in october will show only after the swipe.
So is it possible to "preload" data for one year for exemple?
Thanks!

@twinssbc
Copy link
Owner

@achillelrc I think you are looking for pre-render feature, instead of preload. Because you have the control to load the events from your backend in any time range and cache them at the local. And if you think the latency between swiping and displaying the data is because of the time spent on talking to the backend, you should preload and cache the events.
Regarding the pre-render feature, unfortunately this calendar doesn't support that. Calculating the position of each event and placing them on the current view is already time consuming, if needs to do the same for two more views, you probably will notice quite big delay.

@achillelrc
Copy link
Author

achillelrc commented Sep 30, 2017

oh okay thanks for the answer :)
Yes i was talking about pre render but i don't knew how to describe that.
Okay no matter but now i'm interested by caching my events how can i do that?
Thanks again and sorry for bad english

@twinssbc
Copy link
Owner

@achillelrc Caching events is simple. For example, in theory, you need to only fetch the events between startTime and endTime each time onRangeChanged method is triggered.
But you could add some logic to fetch one year events and assign it to some variable. Then each time onRangeChanged method is triggered, you just extract the slice from the cached events, instead of fetch from the backend.

onRangeChanged = (ev: { startTime: Date, endTime: Date }) => {
      Events.query(ev, (events) => {
          this.eventSource = events;
      });
  };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants