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

Bust the assets cache on modification. #309

Merged
merged 2 commits into from
Aug 10, 2018
Merged

Conversation

T4rk1n
Copy link
Contributor

@T4rk1n T4rk1n commented Jul 31, 2018

Append time modified as query string to assets urls to trick the cache to refresh the file.

cc @plotly/dash

Resolves #303

@rmarren1
Copy link
Contributor

I like this, annoying to always have dev tools open and the cache probably trips up beginners.

Copy link
Member

@chriddyp chriddyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this will work when developing locally, assets will still be cached by the browser when the user deploys the app. The use case I'm imagining is:

  1. Developer deploys their app
  2. Person A visits their app
  3. Developer changes CSS, deploys again
  4. Person A visits again - the CSS is cached from when they visited the app before the previous deploy.

The developer won't see an issue because they got the new version when they were developing, so they might not even know that their visitors will have an issue.

So, I think we should append a time modified query string or some other solution

@T4rk1n T4rk1n changed the title Disable the cache if debug=True. Bust the assets cache on modification. Jul 31, 2018
@T4rk1n
Copy link
Contributor Author

T4rk1n commented Jul 31, 2018

@chriddyp I changed this PR to use time modified query string.

Copy link
Member

@chriddyp chriddyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks for updating this! Once this is released, could you update https://github.com/plotly/dash-docs/blob/master/tutorial/external_css_and_js.py#L160-L163?

@T4rk1n
Copy link
Contributor Author

T4rk1n commented Jul 31, 2018

@chriddyp Ok, I'll release this along with #305 tomorrow.

@chriddyp
Copy link
Member

@T4rk1n - Could we get this one merged and released?

@T4rk1n
Copy link
Contributor Author

T4rk1n commented Aug 10, 2018

@chriddyp
Sorry I thought @bpostlethwaite wanted to chime in, we discussed that in local, we shouldn't add the modified query string for the assets to be mapped to the right local file and instead use the no-cache while on local and use the query string only in a prod settings.

@chriddyp
Copy link
Member

we discussed that in local, we shouldn't add the modified query string for the assets to be mapped to the right local file and instead use the no-cache while on local and use the query string only in a prod settings

OK. Why? It seems to complicate things to have two different ways that caches are invalidated in local vs deployed. Also, we don't have the config abstraction around local vs production yet.

@T4rk1n
Copy link
Contributor Author

T4rk1n commented Aug 10, 2018

That is also my feeling, I'll merge & release.

@T4rk1n T4rk1n merged commit 7d847c6 into master Aug 10, 2018
@T4rk1n T4rk1n deleted the dev-mode-disable-cache branch August 10, 2018 21:04
HammadTheOne pushed a commit to HammadTheOne/dash that referenced this pull request May 28, 2021
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.

None yet

3 participants