-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[flutter_tools] optimize fetch requests and remove main.dart.js bypass #66069
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
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.
LGTM! 🚀 (I left a small nit)
// If the URL is not the RESOURCE list then return to signal that the | ||
// browser should take over. | ||
if (!RESOURCES[key]) { | ||
return event.respondWith(fetch(event.request)); | ||
return; | ||
} |
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.
Ah, I was understanding "remove main.dart.js bypass" wrong. This lets the service worker cache the main.dart.js again, by not overriding its name with a hash.
(I was about to ask: if we want the serviceworker to bypass main.dart.js, shouldn't we also remove it from the RESOURCES map? :P)
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.
Yes, exactly - now that I realize I was COMPLETE WRONG about the default behavior of sw, everything makes more sense!
But we also bypass the worker for http requests that won't go to the cache, since I guess there is overhead for forwarding the requests
flutter#66069) The main.dart.js bypass is not needed now that we have skipWaiting. Additionally optimize the fetch handler so that resources not in the cache skip the service worker altogether. Fixes flutter#66068
Description
The main.dart.js bypass is not needed now that we have skipWaiting. Additionally optimize the fetch handler so that resources not in the cache skip the service worker altogether.
Fixes #66068