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

Content not updating after refresh #10

Closed
preetamslot opened this issue Oct 11, 2019 · 11 comments
Closed

Content not updating after refresh #10

preetamslot opened this issue Oct 11, 2019 · 11 comments
Assignees
Labels
bug Something isn't working

Comments

@preetamslot
Copy link

How can I force the app to download the content and reload the page?
now I see the message "New content is available; please refresh." and refreshing the page wont affect that.
image

@rishabh3112 rishabh3112 self-assigned this Oct 17, 2019
@rishabh3112 rishabh3112 added awaiting response Awaiting user response on issue resolution or clarification bug Something isn't working labels Oct 17, 2019
@rishabh3112
Copy link
Owner

Hi @preetamslot , I have patched the fix for the bug, let me know if it fixes the bug for you.

@Edmund1645
Copy link

Hello @rishabh3112 I don't think it worked, I just published now but the page does not automatically reload.

Is it possible to configure the plugin without using a service worker too?

@rishabh3112
Copy link
Owner

rishabh3112 commented Oct 19, 2019

Hi @Edmund1645 , This issue isn't same as your query.

P.S.
Regarding your query, the plugin is currently meant to be used for production build, but it is a great feature suggestion and will look into it when I got time.

Meanwhile, If you want your suggestion to land quick, open a issue so that we can discuss what canbe done for development build and I will help you to land a PR for this.

@preetamslot
Copy link
Author

@rishabh3112, have updated to the latest version, cleared storage etc. its till gives me the same message :(
image

@rishabh3112
Copy link
Owner

Can you share the service worker that is generated?

@preetamslot
Copy link
Author

preetamslot commented Oct 25, 2019

@rishabh3112
https://unfolding.io/service-worker.js

/**
 * Welcome to your Workbox-powered service worker!
 *
 * You'll need to register this file in your web app and you should
 * disable HTTP caching for this file too.
 * See https://goo.gl/nhQhGp
 *
 * The rest of the code is auto-generated. Please don't update this file
 * directly; instead, make changes to your Workbox build configuration
 * and re-run your build process.
 * See https://goo.gl/2aRDsh
 */

importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");

self.addEventListener('message', (event) => {
  if (event.data && event.data.type === 'SKIP_WAITING') {
    self.skipWaiting();
  }
});

/**
 * The workboxSW.precacheAndRoute() method efficiently caches and responds to
 * requests for URLs in the manifest.
 * See https://goo.gl/S9QRab
 */
self.__precacheManifest = [
  {
    "url": "404.html",
    "revision": "8753d6ea2d2d6780e006c20c792d4252"
  },
  {
    "url": "404/index.html",
    "revision": "8753d6ea2d2d6780e006c20c792d4252"
  },
  {
    "url": "about/index.html",
    "revision": "0438d1aa8810bc38370da6a4cf219f20"
  },
  {
    "url": "admin/index.html",
    "revision": "f6efb85d7594fe562f4d82292f800703"
  },
  {
    "url": "assets/css/styles.styles.58eb1ed7.css",
    "revision": "e0d7faa96437046c1085a0435aefbcf8"
  },
  {
    "url": "assets/data/404/index.json",
    "revision": "72040dee07db2a6cc20f7b50dde93035"
  },
  {
    "url": "assets/data/about/index.json",
    "revision": "612c25fc85a8bc540950033dd8b8a7dc"
  },
  {
    "url": "assets/data/contact/index.json",
    "revision": "daf88fca50b994473e6eb47499c591c4"
  },
  {
    "url": "assets/data/index.json",
    "revision": "0eb8b1ffc59cec207cc4947f8d3f532f"
  },
  {
    "url": "assets/data/people/caja-wong-chung/index.json",
    "revision": "2598faa8320fb48946f6ff0bd30e42c3"
  },
  {
    "url": "assets/data/people/demian/index.json",
    "revision": "f9d251f6b122674590f157507dfd874b"
  },
  {
    "url": "assets/data/people/preetam-slot/index.json",
    "revision": "4712a320bfbd4d9de03e20f7f7724c00"
  },
  {
    "url": "assets/data/service/creative-ideas/index.json",
    "revision": "7d5a404801d26e0af4d6a340fb9c35ec"
  },
  {
    "url": "assets/data/service/print-design/index.json",
    "revision": "ffee06012d9f238ad8805af04ffdda90"
  },
  {
    "url": "assets/data/service/surface-pattern-design/index.json",
    "revision": "938319ae6841dab869d0497462a156f1"
  },
  {
    "url": "assets/data/service/web-development/index.json",
    "revision": "ae05553791fa134ea61ff3b686e70cbb"
  },
  {
    "url": "assets/data/service/webdesign/index.json",
    "revision": "801c9e85ce0ae445856e5327a710152d"
  },
  {
    "url": "assets/js/app.c7d6c53c.js",
    "revision": "7b4a130ce78c94feb6f4a0fc2b2634c2"
  },
  {
    "url": "assets/js/page--node-modules-gridsome-app-pages-404-vue.e76d79e4.js",
    "revision": "7cc5c05ba284a6dde6c5fb41a3b918bc"
  },
  {
    "url": "assets/js/page--src-pages-about-vue.093fee89.js",
    "revision": "3dd3b41604d4b743c353491b8769d243"
  },
  {
    "url": "assets/js/page--src-pages-about-vue~page--src-pages-contact-vue~page--src-pages-index-vue.62104175.js",
    "revision": "9f921cc8083205c12ddbcda2ad943277"
  },
  {
    "url": "assets/js/page--src-pages-contact-vue.6479e5f3.js",
    "revision": "2d962822972c753bbfbdb18999dda83f"
  },
  {
    "url": "assets/js/page--src-pages-index-vue.573e63d1.js",
    "revision": "460f6cb73d033bf45b7cae35fb024b1f"
  },
  {
    "url": "assets/js/page--src-templates-people-post-vue.860b2db4.js",
    "revision": "db20f00737faceba827d170a29864a8b"
  },
  {
    "url": "assets/js/page--src-templates-service-post-vue.be2fc4cc.js",
    "revision": "a69e9badf89d83af98a2cfa5296020a4"
  },
  {
    "url": "assets/js/vendors~page--src-pages-about-vue~page--src-pages-contact-vue~page--src-pages-index-vue.1eecb120.js",
    "revision": "226cd5a7e0b35a81a476f711b9582a67"
  },
  {
    "url": "assets/static/about_2.6ab7b7c.e8a993d.png",
    "revision": "18803acd8685df46c12c1170979a5f96"
  },
  {
    "url": "assets/static/about_2.d185b67.e8a993d.png",
    "revision": "8ca7ac2847012837dbe31164c51c5d02"
  },
  {
    "url": "assets/static/about.6ab7b7c.cb4f7d0.png",
    "revision": "0b3e68d2497126fe7f62c3a3ca7e7734"
  },
  {
    "url": "assets/static/about.d185b67.cb4f7d0.png",
    "revision": "d4dd2ae65f78cd0ee91d590ef415264f"
  },
  {
    "url": "assets/static/caja.1b91758.2a4561c.jpg",
    "revision": "ffe7647f13dd2dcd6d74fb2c1ca9e847"
  },
  {
    "url": "assets/static/caja.6ef341c.2a4561c.jpg",
    "revision": "1c10d8c6b27d62505acb47ca070ec44d"
  },
  {
    "url": "assets/static/caja.a880ec0.2a4561c.jpg",
    "revision": "9cbe0077bd8ac9274fa5b494b88358a9"
  },
  {
    "url": "assets/static/contact.6ab7b7c.7303e97.png",
    "revision": "ed06be42fc128d53377bcb44cb911c8a"
  },
  {
    "url": "assets/static/contact.d185b67.7303e97.png",
    "revision": "7f36b94fd45fcf777436fef59a379c10"
  },
  {
    "url": "assets/static/creativeIdeas.6ab7b7c.de22707.png",
    "revision": "7bcc6bc714e4b80cd78d882a108e2665"
  },
  {
    "url": "assets/static/creativeIdeas.d185b67.de22707.png",
    "revision": "4833201758cedd20ab4756f260b0f772"
  },
  {
    "url": "assets/static/demian.1b91758.f9e8f40.jpg",
    "revision": "0304593919a01e33bbf77d6004dda4ed"
  },
  {
    "url": "assets/static/demian.6ef341c.f9e8f40.jpg",
    "revision": "457bb7009a2f9f2009840eb340fcd46b"
  },
  {
    "url": "assets/static/demian.a880ec0.f9e8f40.jpg",
    "revision": "f005f0221dfc3bb453e6166a43ee8034"
  },
  {
    "url": "assets/static/favicon.1539b60.608a306.png",
    "revision": "a3113ae785a0b385b5fe7ab2664c314f"
  },
  {
    "url": "assets/static/favicon.62d22cb.608a306.png",
    "revision": "65cf5438e79e974a457a11cd71369a05"
  },
  {
    "url": "assets/static/favicon.7b22250.608a306.png",
    "revision": "0a38dfeb45b6ae27fff341dea8e277ca"
  },
  {
    "url": "assets/static/favicon.ac8d93a.608a306.png",
    "revision": "5bd51d74d89bfcfb5985f4a291f8ff4f"
  },
  {
    "url": "assets/static/favicon.b9532cc.608a306.png",
    "revision": "d86a09dab7c787d532dba8b9978767f4"
  },
  {
    "url": "assets/static/favicon.ce0531f.608a306.png",
    "revision": "f66c06aafeabe2878f81c4c398511cdb"
  },
  {
    "url": "assets/static/favicon.dc0cdc5.608a306.png",
    "revision": "67a222934fd4fd93964968892c94e712"
  },
  {
    "url": "assets/static/favicon.f22e9f3.608a306.png",
    "revision": "2188511e244ba150c0665a928aa9ec99"
  },
  {
    "url": "assets/static/favicon.png",
    "revision": "608a306aea940eec7496a1c058716607"
  },
  {
    "url": "assets/static/preetam.1b91758.673b2c3.jpg",
    "revision": "457a07a5c5e2d2d7505cc28a5c26ccfc"
  },
  {
    "url": "assets/static/preetam.6ef341c.673b2c3.jpg",
    "revision": "a6ed8c623e8d19bd20ab7dc45728387b"
  },
  {
    "url": "assets/static/preetam.a880ec0.673b2c3.jpg",
    "revision": "fcf327ffb27a86e4c3bbb71e88d31c58"
  },
  {
    "url": "assets/static/printDesign.6ab7b7c.c03fb23.png",
    "revision": "cd596622941ae083130472207b32f7a4"
  },
  {
    "url": "assets/static/printDesign.d185b67.c03fb23.png",
    "revision": "189b4d2d83769472a52361face6555c5"
  },
  {
    "url": "assets/static/surface_pattern_design.5283c99.a9b4107.png",
    "revision": "864c672f96cdaed8b64960bfd604e2da"
  },
  {
    "url": "assets/static/surface_pattern_design.939b6f4.a9b4107.png",
    "revision": "3493a7ea8f1a2c451bd35b3029451062"
  },
  {
    "url": "assets/static/web-development.5283c99.766924a.png",
    "revision": "df4cef3b8d8d32942a4c01ace2bafec0"
  },
  {
    "url": "assets/static/web-development.939b6f4.766924a.png",
    "revision": "256ce88cee6aa9b5cc0b83a4f2a01443"
  },
  {
    "url": "assets/static/webdesign.6ab7b7c.c05038f.png",
    "revision": "d2ea0006627bd5eb7c165d077e0ac603"
  },
  {
    "url": "assets/static/webdesign.d185b67.c05038f.png",
    "revision": "eccdb23f82548d8600c9c489eb06860d"
  },
  {
    "url": "contact/index.html",
    "revision": "8653e3fa8eb4455be635cc207ccf498b"
  },
  {
    "url": "image/01.jpg",
    "revision": "9eb88f779032c69d8763217e36930508"
  },
  {
    "url": "index.html",
    "revision": "341d30210faf156c7d80401569b1e07f"
  },
  {
    "url": "logo.svg",
    "revision": "27db88daad06bb016623eb973e99bddf"
  },
  {
    "url": "manifest.json",
    "revision": "6ab8b1eae53eaf744226c3c11948a2a2"
  },
  {
    "url": "people/caja-wong-chung/index.html",
    "revision": "02b33fed9503b07e0f0a187c29ab447c"
  },
  {
    "url": "people/demian/index.html",
    "revision": "ee4da655ccdeda408fc177b5385cbfcc"
  },
  {
    "url": "people/preetam-slot/index.html",
    "revision": "501b20a6d8e2e862563fa641f0b386af"
  },
  {
    "url": "service/creative-ideas/index.html",
    "revision": "b7e607c225b239d032d9f25cd101959c"
  },
  {
    "url": "service/print-design/index.html",
    "revision": "3d42366931b0a72c81035c8f326d4677"
  },
  {
    "url": "service/surface-pattern-design/index.html",
    "revision": "060c69a28ede3abc563d334dc06ca808"
  },
  {
    "url": "service/web-development/index.html",
    "revision": "a0ac2a2025621846fbbe79e75d866c30"
  },
  {
    "url": "service/webdesign/index.html",
    "revision": "b071cb4f89884ea9e0228a1113be57a7"
  },
  {
    "url": "uploads/about_1.png",
    "revision": "d4f463a943589c8c42c86db432ccf35b"
  },
  {
    "url": "uploads/about_2.png",
    "revision": "e8a993da63681ba2be899c9faa5a6e4d"
  },
  {
    "url": "uploads/about.png",
    "revision": "cb4f7d0298a68f5ef30c66b98524d6b9"
  },
  {
    "url": "uploads/caja.jpg",
    "revision": "2a4561c664de4b8564f3f5de732c869f"
  },
  {
    "url": "uploads/contact.png",
    "revision": "7303e9786ff1528f24c0a0266cba83f2"
  },
  {
    "url": "uploads/creativeIdeas.png",
    "revision": "de2270766b93488c6abc6dd8f28d67f4"
  },
  {
    "url": "uploads/demian.jpg",
    "revision": "f9e8f40a9baeb0fc1450e7228daf1470"
  },
  {
    "url": "uploads/photo.png",
    "revision": "e59b5fcb22dd53ab2d7812604b5b840b"
  },
  {
    "url": "uploads/preetam.jpg",
    "revision": "673b2c341e7b9aa45114fd81f2f67c45"
  },
  {
    "url": "uploads/printDesign.png",
    "revision": "c03fb230bdeab513d6e6fac13e556f56"
  },
  {
    "url": "uploads/soldenserra.png",
    "revision": "c134f922c698325e87171951b6a0331c"
  },
  {
    "url": "uploads/surface_pattern_design.png",
    "revision": "a9b4107a9d07a3811c18e77633b42824"
  },
  {
    "url": "uploads/web-development.png",
    "revision": "766924a1c2fd3425a1450c3cb8703e2b"
  },
  {
    "url": "uploads/webdesign.png",
    "revision": "c05038f736938c936f77cc45102fbce2"
  },
  {
    "url": "404",
    "revision": "58562ccce683f1fa20f0b08d84a700bb"
  },
  {
    "url": "service/web-development",
    "revision": "9f7583c1fee3d02eff53f4c136212b0b"
  },
  {
    "url": "service/webdesign",
    "revision": "de867cbfc135988ea51c3412b7780200"
  },
  {
    "url": "service/surface-pattern-design",
    "revision": "7be4da3a9218eb1a68bd839ffda4810a"
  },
  {
    "url": "service/print-design",
    "revision": "fb0c4181e23a3e091e8e506f2ebe680e"
  },
  {
    "url": "people/preetam-slot",
    "revision": "3cbb56c9cd1e3a722a6d782894295192"
  },
  {
    "url": "service/creative-ideas",
    "revision": "d06899277b1f425d54e417b265fa7bc3"
  },
  {
    "url": "people/caja-wong-chung",
    "revision": "41c9fa0a574eabc16b119a419e8904ff"
  },
  {
    "url": "people/demian",
    "revision": "0e7d0d4dd7ec0c422f95e49d1400b424"
  },
  {
    "url": "contact",
    "revision": "c169ae72704e998675892234277690e3"
  },
  {
    "url": "about",
    "revision": "d5ed40a85efa7fda2465f2d9ecd19e61"
  }
].concat(self.__precacheManifest || []);
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});

addEventListener('message', event => {
  const replyPort = event.ports[0]
  const message = event.data
  if (replyPort && message && message.type === 'skip-waiting') {
    event.waitUntil(
      self.skipWaiting().then(
        () => replyPort.postMessage({ error: null }),
        error => replyPort.postMessage({ error })
      )
    )
  }
})

@rishabh3112
Copy link
Owner

Cool, will look into this soon.

@rishabh3112 rishabh3112 added awaiting resolution Solution is well defined and straightforward and removed awaiting response Awaiting user response on issue resolution or clarification labels Oct 25, 2019
@rishabh3112
Copy link
Owner

image
image

No reload issues as of now on your site. I think you haven't hard refreshed website after plugin update.
I am closing the issue, feel free to open the issue if you have any other example of this being a issue.

@rishabh3112 rishabh3112 removed the awaiting resolution Solution is well defined and straightforward label Oct 25, 2019
@exreplay
Copy link

exreplay commented Nov 19, 2019

There is a workaround which forces the service worker to skip waiting without triggering the event. In your gridsome.server.js file add the following lines:

module.exports = function(api) {
  // some code before....
  api.afterBuild(() => {
    const outDir = api._app.config.outputDir;
    let swPath = '';
    for (const plugin of api._app.plugins._plugins) {
      if (plugin.api._entry.use === 'gridsome-plugin-pwa') {
        swPath = path.join(outDir, plugin.api._entry.options.serviceWorkerPath);
        break;
      }
    }
    let swFile = fs.readFileSync(swPath, 'UTF-8');
    swFile += '\n\nworkbox.core.skipWaiting()';
    fs.writeFileSync('./dist/service-worker.js', swFile);
  });
  // some code after....
};

This just appends a new line to the service-worker.js file with the command for workbox to skipWaiting. I know that this approach is hacky, especiallly because using internal variables to determine the sw path, but couldn't come up with anything else and needed a quick fix.

It would be a good thing for the plugin to pass config params to the generateSw function. This way it is possible to add the skipWaiting config param and any other.

@preetamslot
Copy link
Author

@exreplay the "path" in
swPath = path.join(outDir, plugin.api._entry.options.serviceWorkerPath);
what does it reference to?
in my config it is not defined

@exreplay
Copy link

@preetamslot it refers to the built in node package path. Just require it with const path = require('path')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants