Lazily load events as they come into view (OFC-5) #326
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Loading events into FullCalendar is expensive. See #323 for details on how
FullCalendar.addEvent()
chokes on a 900-event calendar.This PR will make use of event-generating functions in FullCalendar to lazily load events to the calendar as they come into view. OFCEventSource, which is returned from getAllEvents(), will have a function that takes in a start and end date and will return all events in the specified calendar that fall within those bounds.
Considerations:
only non-recurring events have a real start date. All recurring events will always have to be loaded in to the calendar.
Can addEvent() still be used when updating single events around with click and drag?
How to use
EventSource.refetch()
properly to re-draw the calendar? Will there be flickering?Naiive implementation of
getEventsWithinBounds()
onEventStore
that just filters the events in the list.Unit tests for
getEventsWithinBounds()
.Plumb event-generating functions that query the
EventStore
through theEventCache
andview.ts
. At this point the change should be fully functional, can do some testing to see if it makes Obsidian Unresponsive While Full Calendar Fetches Remote Calendars (Such as Google Calendar) #323 any better.Efficient implementation of
getEventsWithinBounds()
withbtree-typescript
. Create a btree whose key isCalendarId-StartDate-EventId
and whose value isEventId
. Can then query for all entries in between[calendar-start, calendar-endplusone)
to get all the matching events.