Skip to content
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): "Magic" JS detection to make sites function correctly when JS is disabled retroactively #17590

Merged
merged 13 commits into from Sep 19, 2019

Conversation

@davidbailey00
Copy link
Member

davidbailey00 commented Sep 12, 2019

Description

gatsby-plugin-offline's service worker (which still runs if JavaScript has been disabled retroactively) can now detect via a conditional network request whether or not JavaScript has been disabled in the browser, and serve a page from the network if this is the case.

Related Issues

Closes #17386

@davidbailey00 davidbailey00 requested a review from gatsbyjs/core as a code owner Sep 12, 2019
… misc
@davidbailey00 davidbailey00 changed the title feat(gatsby-plugin-offline): "Magic" JS detection to make sites function correctly when JS is disabled later feat(gatsby-plugin-offline): "Magic" JS detection to make sites function correctly when JS is disabled retroactively Sep 13, 2019
@KyleAMathews

This comment has been minimized.

Copy link
Contributor

KyleAMathews commented Sep 17, 2019

Nice "magic" :-D

@@ -15,9 +15,6 @@ export default function HTML(props) {
</head>
<body {...props.bodyAttributes}>
{props.preBodyComponents}
<noscript key="noscript" id="gatsby-noscript">
This app works best with JavaScript enabled.
</noscript>

This comment has been minimized.

Copy link
@pieh

pieh Sep 19, 2019

Contributor

should this change be part of this PR?

This comment has been minimized.

Copy link
@pieh

pieh Sep 19, 2019

Contributor

Also for reference - this is PR that added this initially #10945 so worth checking reasoning and see if we don't break that (or at least it's conscious decision)

@pieh
pieh approved these changes Sep 19, 2019
Copy link
Contributor

pieh left a comment

Looks great! Thanks!

@gatsbybot gatsbybot merged commit e451815 into gatsbyjs:master Sep 19, 2019
20 checks passed
20 checks passed
Danger All good
Details
Peril All green. Nice work.
Details
ci/circleci: bootstrap Your tests passed on CircleCI!
Details
ci/circleci: e2e_tests_development_runtime Your tests passed on CircleCI!
Details
ci/circleci: e2e_tests_gatsby-image Your tests passed on CircleCI!
Details
ci/circleci: e2e_tests_path-prefix Your tests passed on CircleCI!
Details
ci/circleci: e2e_tests_production_runtime Your tests passed on CircleCI!
Details
ci/circleci: integration_tests_gatsby_pipeline Your tests passed on CircleCI!
Details
ci/circleci: integration_tests_long_term_caching Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: starters_validate Your tests passed on CircleCI!
Details
ci/circleci: themes_e2e_tests_development_runtime Your tests passed on CircleCI!
Details
ci/circleci: themes_e2e_tests_production_runtime Your tests passed on CircleCI!
Details
ci/circleci: unit_tests_node10 Your tests passed on CircleCI!
Details
ci/circleci: unit_tests_node12 Your tests passed on CircleCI!
Details
ci/circleci: unit_tests_node8 Your tests passed on CircleCI!
Details
ci/circleci: unit_tests_www Your tests passed on CircleCI!
Details
ci/circleci: windows_unit_tests Your tests passed on CircleCI!
Details
cypress: default-group 67 tests passed in 00:33
Details
unit_tests_windows Build #20190919.31 succeeded
Details
LOLdevelopr added a commit to LOLdevelopr/gatsby-1 that referenced this pull request Sep 21, 2019
…ion correctly when JS is disabled retroactively (gatsbyjs#17590)

* Set path resources on route update (for initial page load)

* begin "magic"

* refactor + fix always re-enabling

* implement SW API route + only set head components for offline shell + misc

* update snapshots

* change messageapi back to a "normal" object

* add comment re: syntax

* rename back to original casing

* add back noscript warning in default-html

* restore snapshots
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.