-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
feat(gatsby): Rewrite resource loading - retry mechanism #14889
feat(gatsby): Rewrite resource loading - retry mechanism #14889
Conversation
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've updated the PR to be in a working state ^^. Well done @Moocar this had to be super hard 😛. We probably want to add some more tests & cleanup a bit like you mentioned. We can give it a spin on gatsbyjs.org for the meantime
f4a9731
to
a4daff1
Compare
Thanks for continuing the work on this @wardpeet! Much appreciated. |
I think we've cracked the "Missing Resource for '/'" problem! Looking at sentry, this error has basically dropped off and the few that are still happening came from older releases (so people on service workers) https://sentry.io/organizations/gatsby-inc-9z/issues/1054226255/tags/release/ This seems ready to go. |
Great stuff !! Do we have a timeline on when this will be merged to master? |
Writing tests and than we can merge. If it's not today than it will be tomorrow. I'll try my best to finish it today |
438268c
to
90c5813
Compare
🎉 @wardpeet looks like there are some merge conflicts to fix up? |
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.
Awesome work @Moocar & @wardpeet! This makes our runtime a lot more robust and adds a ton of tests which will help ensure continual high quality moving forward.
One note of worry — this does increase our default JS bundle by 2kb — with this PR, we've grown by 12kb since the launch of v2 to 66kb from 54kb — I'm guessing a lot of that comes from the recent PR to start compiling node_modules #14111
We should start tracking our default bundle size and do some code golfing to clean things up
|
Im getting a 403 hosting my site with S3 / cloudfront. Its adding an extra / before page-data.json causing issues. Works as expected on localhost:8000 but on my cloudfront distribution its adding a slash. local: http://localhost:8000/page-data/apply-now/page-data.json as you can see there is a missing bit there. Anyone have a solution? im also not sure if this is the correct place to post this, if it isn't could someone point me into the right direction? |
) * first stab * ordering of requires * working in production * make page-changer like ensure-resources * production-app working * adding status checks on pageResources when requests fail * quickfix to check if preload data works on e2e | discard later * fix e2e-tests - need some refactoring though * add extra pageData cache map * fallback to dev 404 page if no 404 can be found * add unit tests for loadPageDataJson * Fix 404 error handling * add unit tests for loadPage * Add unit tests for prefetch * consistent jest funcs * fix tests? * upgrade babel-preset-env to include promise.finally * include e7 promise finally * Revert "upgrade babel-preset-env to include promise.finally" This reverts commit f1aecc8. * fix client only paths * use realpath
I won't be able to work on this for another week or so. Posting here in case anyone wants to take a stab at finishing it. Also a good opportunity to get feedback on the actual solution.
Description
Rewrite of
loader.js
. Goals are:XmlHttpRequest.readyState === 4
, andstatusCode === 0
loadSyncOr404
.loader.pageDb
, and periodically expire them, or lazily re-request.Still TODO
production-runtime
anddevelop-runtime
end to end testsThings I'm not happy with
EnsureResources
, specifically how it uses the React lifecycle functions to cause loader retries. I tried removing it, but found out it's necessary to support forwards/back functionality after a refresh. It would be great to trigger resource loading directly off window.history events, possibly even removing Reach Router entirely. Maybe one day :)Related Issues