Comments (5)
@AileenCGN This should work: https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#cache-then-network
from docs.
This issue is related to gatsbyjs/gatsby#10036 which is not yet fixed in Gatsby itself.
We keep having issues with Safari with the docs site due to the service worker setup serving stale content. It's not being cleared at all when new content is pushed and it's very difficult to clear stale content manually (no luck with cache clear, deletion of indexed db records, or running with dev tools open and cache disabled).
We should consider changing the service worker strategy to fetch from network with local fallback? That's generally the approach taken for production sites where content is expected to change and would solve the Safari problems and the need to force a refresh in Chrome.
👉 https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/
👉 https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-plugin-offline
It appears that we can change the strategy for certain parts of the site, which need to be defined. See default config, that Workbox (underlying SW module used in gatsby-plugin-offline):
const options = {
importWorkboxFrom: `local`,
globDirectory: rootDir,
globPatterns,
modifyUrlPrefix: {
// If `pathPrefix` is configured by user, we should replace
// the default prefix with `pathPrefix`.
"/": `${pathPrefix}/`,
},
cacheId: `gatsby-plugin-offline`,
// Don't cache-bust JS or CSS files, and anything in the static directory,
// since these files have unique URLs and their contents will never change
dontCacheBustUrlsMatching: /(\.js$|\.css$|static\/)/,
runtimeCaching: [
{
// Use cacheFirst since these don't need to be revalidated (same RegExp
// and same reason as above)
urlPattern: /(\.js$|\.css$|static\/)/,
handler: `cacheFirst`,
},
{
// Add runtime caching of various other page resources
urlPattern: /^https?:.*\.(png|jpg|jpeg|webp|svg|gif|tiff|js|woff|woff2|json|css)$/,
handler: `staleWhileRevalidate`,
},
{
// Google Fonts CSS (doesn't end in .css so we need to specify it)
urlPattern: /^https?:\/\/fonts\.googleapis\.com\/css/,
handler: `staleWhileRevalidate`,
},
],
skipWaiting: true,
clientsClaim: true,
}
from docs.
Gatsby offline plugin is updated and closed the issue gatsbyjs/gatsby#10036 (comment)
Will update the dependencies shortly and see if that solved our issues without changing the strategy.
from docs.
This should - hopefully - be solved now with TryGhost/gatsby-starter-ghost@9ab4a78 and 279bd32 which include dependency updates for the gatsby-plugin-offline.
According to the related issue in Gatsby
old bugs can still appear once the site has updated, due to browsers having the previous SW installed, but future updates should be okay assuming the bug was fixed because by that point, browsers have installed the latest SW.
This is also what I experienced and am therefor optimistic about this fix.
Safari:
- I had visited https://docs.ghost.org before this dependency update.
- After the update the usually experienced "blank page" did not occur and it seemed to load fine.
- The console stated that the sw got installed, which I assume is the fixed one.
It would be good to get some feedback regarding this issue with Safari, which I wasn't able to test:
We keep having issues with Safari with the docs site due to the service worker setup serving stale content. It's not being cleared at all when new content is pushed and it's very difficult to clear stale content manually (no luck with cache clear, deletion of indexed db records, or running with dev tools open and cache disabled).
Chrome:
- I had visited https://docs.ghost.org before this dependency update
- After the update the usually experienced "blank page" did occur, but only for a second.
- The console stated that the sw got installed, which I assume is the fixed one.
from docs.
I close this issue for now, but we need to keep an 👀 on it. I will reopen it when it turns out to still be causing problems.
from docs.
Related Issues (20)
- May I add the storage adapter of Tencent Yun to the docs?
- Disqus integrations missing ; this.page.identifier = "ghost-{{comment_id}}"
- google-cloud-storage adapter is unmaintained, doesn't work with latest Ghost
- Webhooks page does not list all available webhooks
- Add no-script fallback script HOT 2
- Switch to use tags helper from Ghost-SDK HOT 2
- Add unit tests HOT 1
- Expand e2e test and setup for continuous integration HOT 1
- Refactor gatsby files to be more readable
- Automate sidebar navigation from `.yaml` files as plugin
- Apply vertical rhythm to responsive images
- Docs style guides
- Clicking search results doesn't always take you to the page
- '@blog' helper still listed in the handlebars docs leading to a 404.
- How to get client id and client secret
- Invalid link in docs HOT 1
- Add Google OmniBox support HOT 1
- [Readme] Add docs on building algolia search index HOT 3
- Custom ordering alias for ordering featured posts first HOT 1
- Admin Api Docs have several problems HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docs.