-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Remove the navigateFallback behavior from the generated service worker #3419
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
this seems to make my pull request at #3024 obsolete it contains the same change but with better documentation. i will close my pr |
There should be some way to keep current behavior as after upgrading CRA existing apps will break in offline mode and there would be no way to fix them - perhaps global switch in package.json. Other solution is to keep current behavior and add an exception - for example for API calls, like in #3029. |
Another solution would be to provide fallbacks only if the accept header is |
I believe this is a good trade-off, thanks for the excellent explanations @jeffposnick. |
@piotr-cz, every modern browser sends |
@jeffposnick My idea is to differentiate navigation requests ( |
@piotr-cz: API and all other subresource requests were already being differentiated, by virtue of checking for This differentiation wasn't sufficient to prevent confusion for a subset of developers, for all the reasons noted in the various bugs linked to from this PR. |
If we can’t expose customization of the SWPrecacheWebpackPlugin configs without ejecting, I think this is the best default behavior. The biggest benefit I get from Create-React-App is keeping the compilation step of my front-end up-to-date for a Node app. However, that doesn’t work if our API endpoints are being blocked by the service worker. Would this be considered a breaking change if it only breaks offline 404s? |
@seejamescode Are you sure the API endpoints are blocked by service worker? |
Sorry for vagueness earlier. The particular situation is that my homepage has an anchor link to an Express get request using |
Looks like there must be at least one navigateFallback path exclusion for implementing oAuth. |
#3419) * Disables navigateFallback and updates the README * Typos * Updated a URL in a comment.
facebook#3419) * Disables navigateFallback and updates the README * Typos * Updated a URL in a comment.
#3419) * Disables navigateFallback and updates the README * Typos * Updated a URL in a comment.
facebook#3419) * Disables navigateFallback and updates the README * Typos * Updated a URL in a comment.
facebook#3419) * Disables navigateFallback and updates the README * Typos * Updated a URL in a comment.
#3419) * Disables navigateFallback and updates the README * Typos * Updated a URL in a comment.
#3419) * Disables navigateFallback and updates the README * Typos * Updated a URL in a comment.
#3419) * Disables navigateFallback and updates the README * Typos * Updated a URL in a comment.
#3419) * Disables navigateFallback and updates the README * Typos * Updated a URL in a comment.
#3419) * Disables navigateFallback and updates the README * Typos * Updated a URL in a comment.
#3419) * Disables navigateFallback and updates the README * Typos * Updated a URL in a comment.
facebook#3419) * Disables navigateFallback and updates the README * Typos * Updated a URL in a comment.
Now that service worker registration is disabled by default by #3817, wouldn't it make sense to revert this commit? I'd say that developers who opt in to use service workers would also expect the app to work offline when using History API like React Router or as receiver of Web Share API URLs |
Accommodating all deployment scenarios is still tricky, but yes, I'd imagine that once enabling service workers is opt-in, the developers who do choose to enable them are more likely to benefit from So I could see the rationale behind reverting this PR for the next major release. |
Can we open a new issue to talk about this please? |
…ce worker (facebook#3419)" This reverts commit b6aebb9. # Conflicts: # packages/react-scripts/template/README.md
@jeffposnick |
facebook#3419) * Disables navigateFallback and updates the README * Typos * Updated a URL in a comment.
facebook#3419) * Disables navigateFallback and updates the README * Typos * Updated a URL in a comment.
webpack config by default. See facebook/create-react-app#3419
Fixes #3248
Fixes #3008
I'd consider this is a breaking change for folks who relied on the old default behavior, so rolling this out as part of an appropriately versioned release of
create-react-app
would make sense.CC: @gaearon @Timer @addyosmani @chee