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

serviceworker loads html resource for home page resource #294

Open
joepio opened this issue Feb 4, 2023 · 0 comments
Open

serviceworker loads html resource for home page resource #294

joepio opened this issue Feb 4, 2023 · 0 comments
Assignees

Comments

@joepio
Copy link
Member

joepio commented Feb 4, 2023

  • Use atomic-server from this pr .
  • Open a page (on 9883, not vite)
  • Refresh the page
  • In the drive resource: Could not parse JSON from fetching http://localhost:9883. Is it an Atomic Data resource? Error message: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
  • Pressing retry or cmd+shift+r fixes the issue

This issue appeared after I basically fixed the PWA. So I guess most of the PWA is now working as intended, yay!

But it seems to return a HTML page for a JSON-AD request. I think theres some content-type stuff that needs to be applied in the cache - not sure. @Polleps do you have ideas?

In generated sw.js, we see precacheAndRoute[{ url: "index.html", revision: "8a969531351da465020b0e1390a4cca4" ...], which is probably what we want - not not for JSON-AD requests.

On a related note, I notice that the service worker caches - every single HTML request. It only needs to cache ONE html response (the root), all others should not be cached.

What makes this bug really annoying, is that it disappears when I open the dev tools. Does chrome ignore service workers when tools are open?

Precache manifest

This is probably where it's at. In vite.config.js, we specify a workbox object.

EDIT: I think I 'fixed' it by ignoring index.html. Probably disables the most important advantage (caching the HTML page), but solves the issue for now.

@joepio joepio changed the title serviceworker loads html resource serviceworker loads html resource for home page resource Feb 4, 2023
joepio added a commit that referenced this issue Feb 4, 2023
joepio added a commit that referenced this issue Feb 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants