Skip to content

Instantly share code, notes, and snippets.

View ro-savage's full-sized avatar

Rowan Savage ro-savage

View GitHub Profile
@ro-savage
ro-savage / PlannerContainer.jsx
Last active April 1, 2020 23:25
Relay - Refetching Data
/*
Because the user see a few months forward, and usually interacts with future events. We load the data for all future events.
If the user goes backward, we refetch all the data from their current date they are viewing and into the future.
If they move forward from there (and back again but not futher) we don't need to load any extra data.
We debouce this so if a user goes back multiple months, it doesn't fetch data multiple times.
This is not ideal. Ideally we would have a "From" and "To" dates, we would initially load 6 month of data.
Then if the user goes backward, it would only get the data they are missing from the server by changing the "From" and "To"
dates and then merging the newely retrieved data.