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

loaded js gets stale on subsequent deploys #214

Open
kryali opened this issue May 26, 2024 · 3 comments
Open

loaded js gets stale on subsequent deploys #214

kryali opened this issue May 26, 2024 · 3 comments

Comments

@kryali
Copy link

kryali commented May 26, 2024

Hi there, I am finding that when deploying new versions of my rails application, the javascript running on the iOS client version gets a bit stale.

That is, I need to completely refresh the WKWebView to pull down the new client-side changes from the server (e.g. via hard refresh or force close). I notice that this staleness tends to occur when I add a new js dependency or modify existing behavior in certain cases.

Is this a known issue? Let me know if I am being unclear. Thanks!

@iamjohnford
Copy link

Do you have data-turbo-track="reload" set? For example:

<link rel="stylesheet" href="..." data-turbo-track="reload" />
<script src="..." data-turbo-track="reload"></script>

@kryali
Copy link
Author

kryali commented Aug 1, 2024

Yes indeed, I have reload set like below

  <%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %>
  <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>

I ended up forcing a reload on the page client-side when the version changed. Not sure why my sessions were getting stale after a while, it was hard to reproduce reliably.

@iamjohnford
Copy link

Just did a test by changing some CSS in my development environment, did a pull to refresh, and it worked okay. I think the standard setup handles that okay.

You already found a solution, and may have tried these during your debugging, but these are some other thoughts if you decide to try to tackle it again:

  • Double-check making a change and refreshing in a regular web browser is working okay. Could be something in the way your assets are building that's not working as expected like the file name not changing.
  • Try loading the demo app and point to your url. If pull to refresh works as expected maybe it's something in iOS changes that you made.
  • Confirm you don't have any other caching headers, or something going on with the server/CDN, that would prevent the new content from loading when refreshing.

If everything is okay now you may want to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants