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

README update - avoid isses related to browser cache during development #94

Closed
wants to merge 1 commit into from

Conversation

equivalent
Copy link

related to hours spent figuring out #90 :)

@dhh
Copy link
Member

dhh commented May 22, 2022

@brenogazzola We should think about a better solution here. But one does not immediately come to mind!

@brenogazzola
Copy link
Collaborator

Since the server is only used in development we could change the cache-control header to no cache or no store for css files. I’ll test it and see what happens.

@brenogazzola
Copy link
Collaborator

brenogazzola commented May 23, 2022

Ok, to make things clear: The problem is that the digest of the application.js file does not change, even though the digests of the files it includes did change. And because the .digest is also used as an ETAG, even if we use no-cache or no-store, the browser will not redownload.

We have two options:
1 - Calculate the digest of including files after the compiler of the included files are run
2 - Remove the ETAG header and use a no-cache and last-modified header that somehow will notice that the compiled file was modified

I will see about doing one of the two (or maybe something else)

@brenogazzola
Copy link
Collaborator

Possible PR to fix this: #96

@brenogazzola
Copy link
Collaborator

Closed that one. It's still going to be a problem in production.

@brenogazzola
Copy link
Collaborator

I've been testing this our outside of rails, and it seems this is a normal problem with the @import rule. Browsers cache the files and don't notice if you change the @import inside them. I thought they might skip caching or something like that, but no. So we can't cheat and copy their behavior.

All solutions I've tried so far get stuck in one of two:
1 - You need stable fingerprints in production (no cache busting on every deploy)
2 - You might have multiple levels of @import or cyclical @import

@dhh
Copy link
Member

dhh commented Dec 16, 2022

Could we simply send no-cache headers in development?

@equivalent
Copy link
Author

equivalent commented Dec 29, 2022

Yes in fact the no-cache header does the trick ! 🎉. Creating new PR with solution => #124

thx @brenogazzola @dhh

closing this one

@equivalent equivalent closed this Dec 29, 2022
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

Successfully merging this pull request may close these issues.

3 participants