-
Notifications
You must be signed in to change notification settings - Fork 17
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
Hit static landing page data #768
Conversation
modules/landing/LandingCharts.tsx
Outdated
useQuery( | ||
['primer'], | ||
() => | ||
fetchActualTripsByLine({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thoughts about making this a query that might actually get called later so we can also benefit from the local cache? Right now this is under the key primer
and therefore this cached call will never be used. Either remove the ONE_HOUR local cache or hit an endpoint with params/keys that might be called on a subsequent page
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's an interesting point, and I was thinking about it for a bit. I think if we try to use a useful value, we're more likely to create more wasteful operations. We have no idea what the user is gonna do next, so the query is likely to end up not being used anyway.
I also think this solution is a bit hacky and I hope to have a better fix in the future, so I think keeping it clearly a "useless" function with the name primer
reduces the odds that it causes confusion down the line. Whereas the performance benefits seem very minor at best.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least use useDeliveredTripMetrics
with the set of params you used here, so the cache could be used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just one thought about trying to be practical with cache
modules/landing/LandingCharts.tsx
Outdated
useQuery( | ||
['primer'], | ||
() => | ||
fetchActualTripsByLine({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least use useDeliveredTripMetrics
with the set of params you used here, so the cache could be used
Motivation
The landing page data was slow to load on the first query.
Changes
Fetch landing page data from
/static
folder. Uploaded by a lambda in this pr: transitmatters/data-ingestion#33Add a "primer query" to landing page to get the lambdas warm for when the user goes to next page.
Testing Instructions
Check landing page -> make sure data is all there.