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

Caching core files (e.g. site.webmanifest) #86

Closed
tacman opened this issue Mar 2, 2024 · 3 comments · Fixed by #95
Closed

Caching core files (e.g. site.webmanifest) #86

tacman opened this issue Mar 2, 2024 · 3 comments · Fixed by #95
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@tacman
Copy link
Contributor

tacman commented Mar 2, 2024

Version(s) affected

1.0

Description

When I go offline, most of the files that fail loading are core files, like es-shim-module and site.webmanifest. Also some js files.

The site appears to work okay, so maybe this behavior is expected, especially if it's cache-then-network.

But if there's a way to avoid seeing those errors, it would be easier to find other errors, like assets being incorrectly loaded from unpkg or other site.

How to reproduce

Go to https://noise.survos.com/

refresh, go offline, refresh, open the network tab, sort by status.

Possible Solution

No response

Additional Context

No response

@tacman
Copy link
Contributor Author

tacman commented Mar 2, 2024

Hmm, something strange is going on, like a short-lived cached or something.

When I run noise.wip locally, after turning off the network I only get a handful of failure. But when it runs on the production server, after one refresh it works, but then a shift-refresh shows lots of .js errors as well.

Maybe .js are treated differently than .css? The js has a hash. Again, maybe this behavior is expected offline.

@Spomky
Copy link
Member

Spomky commented Mar 4, 2024

Hi,

Indeed, /site.webmanifest and /sw.js could be cached with NetworkFirst or StaleWhileRevalidate strategies. This could be a nice addition.

Regarding the issue with the mp3 file, I think I understand the problem.
The files are present in the cache and should be served.
I noted the audio player is trying to get the file from the URL /assets/./sounds/WhiteNoise-cf4b8dbe1373cbca5439afb52a01a7ba.mp3. To me the issue comes from the extra ./ in the URL that does not match the cached URL.
At line noise-index.html.twig#L30, could you try with {{ asset('sounds/WhiteNoise.mp3') }}?

@Spomky Spomky self-assigned this Mar 4, 2024
@Spomky Spomky added the enhancement New feature or request label Mar 4, 2024
@Spomky Spomky added this to the 1.1.0 milestone Mar 4, 2024
@Spomky Spomky linked a pull request Mar 5, 2024 that will close this issue
4 tasks
@Spomky Spomky closed this as completed in #95 Mar 5, 2024
Copy link

github-actions bot commented Apr 6, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants