-
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-plugin-offline): replace no-cache detection with dynamic path whitelist #9907
Merged
Merged
Changes from 9 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
6f53bb1
Remove all no-cache code
41a932a
Remove references to no-cache in offline plugin
a191ffe
Merge upstream/master into origin/master
a1cecf4
Initial work on hybrid navigation handler
1807752
Refactor whitelist code to allow it to support onPostPrefetchPathname
8f3cd4b
Fix service worker detection
8d826c6
Fix IndexedDB race condition
e8224ea
Prevent race conditions + reset whitelist on SW update
c60bb5c
Remove unnecessary API handler (onPostPrefetchPathname is called anyway)
465a4d2
Add debugging statements + fix some minor problems
c62c378
Fix back/forward not working after 404
4d47124
Remove unneeded debugging statements
b233cf6
Bundle idb-keyval instead of using an external CDN
7c4a2b6
Update README
0923c67
Merge upstream/master into origin/hybrid-offline-shell
25e4ecf
Fix excessive file caching (e.g. GA tracking gif)
23599eb
Backport fixes from #9907
e02f9d5
minor fixes for things I copy-pasted wrong
ffc5868
Merge origin/backport-9415-fix into origin/hybrid-offline-shell
fbeee6d
Merge upstream/master into origin/hybrid-offline-shell
0d0b001
Fetch resources the same way in enqueue to getResourcesForPathname
b9857c6
Revert "Fetch resources the same way in enqueue to getResourcesForPat…
6d6762c
Refactor prefetching so we can detect success
b7f8b83
Move catch to prevent onPostPrefetchPathname after failure
37034bc
Revert "Move catch to prevent onPostPrefetchPathname after failure"
0dcface
Merge upstream/master into hybrid-offline-shell
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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 thought we were gonna go a configurable whitelist approach instead of the indexeddb approach? I'm fine with either, just want to set expectations so I'm aware.
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 tried that at first (with the first two commits of this PR) but realised it wouldn't be a great solution given that some sites might depend on the existing functionality - this is a much more reliable solution since it only whitelists pages whose resources have successfully downloaded, so doesn't e.g. prevent Netlify CMS from working.
If we make assumptions about the default whitelist then it would make things worse for people who put Gatsby pages in places like /admin (maybe they're making a custom admin panel), since these pages wouldn't work offline.
Also, just to clarify in case there's any confusion - the original idea was to use the IDB to replace ?no-cache=1 by temporarily blacklisting pages which are detected to not be Gatsby. While this approach uses IDB, it works in the opposite way by only whitelisting pages on which Gatsby is detected, since this is easier to do and safer. (Sorry if you were already aware of that!)