Uh oh!
There was an error while loading. Please reload this page.
Remove the navigateFallback behavior from the generated service worker - #3419
Conversation
facebook-github-bot
commented
Nov 6, 2017
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! |
chee
commented
Nov 6, 2017
this seems to make my pull request at #3024 obsolete it contains the same change but with better documentation. i will close my pr |
piotr-cz
commented
Nov 9, 2017
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. |
piotr-cz
commented
Nov 9, 2017
Another solution would be to provide fallbacks only if the accept header is |
Timer
commented
Nov 9, 2017
I believe this is a good trade-off, thanks for the excellent explanations @jeffposnick. |
jeffposnick
commented
Nov 9, 2017
@piotr-cz, every modern browser sends |
piotr-cz
commented
Nov 9, 2017
@jeffposnick My idea is to differentiate navigation requests ( |
jeffposnick
commented
Nov 9, 2017
@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. |
seejamescode
commented
Jan 4, 2018
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? |
piotr-cz
commented
Jan 5, 2018
@seejamescode Are you sure the API endpoints are blocked by service worker? |
seejamescode
commented
Jan 5, 2018
Sorry for vagueness earlier. The particular situation is that my homepage has an anchor link to an Express get request using |
piotr-cz
commented
Jan 8, 2018
Looks like there must be at least one navigateFallback path exclusion for implementing oAuth. |
Timer
commented
Jan 10, 2018
|
#3419) * Disables navigateFallback and updates the README * Typos * Updated a URL in a comment.
react#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.
react#3419) * Disables navigateFallback and updates the README * Typos * Updated a URL in a comment.
react#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.
react#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 |
jeffposnick
commented
Jan 19, 2018
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. |
Timer
commented
Jan 19, 2018
Can we open a new issue to talk about this please? |
…ce worker (react#3419)" This reverts commit b6aebb9. # Conflicts: # packages/react-scripts/template/README.md
@jeffposnick |
react#3419) * Disables navigateFallback and updates the README * Typos * Updated a URL in a comment.
react#3419) * Disables navigateFallback and updates the README * Typos * Updated a URL in a comment.
webpack config by default. See react/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-appwould make sense.CC: @gaearon@Timer@addyosmani@chee