Replies: 1 comment
-
It doesn't seem to be a problem with trunk, so I'll close this. Sorry for the noise. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I have a problem with trunk serve, and I'm not entirely sure it isn't something I did wrong. Basically my issue is that when i run
trunk serve
and change something in my code, the browser seems to reload the page, but for some reason, it doesn't update the HTML code of the page, so it ends up using the old filenames of the resources and fails to load them. The version of the code used doesn't even seem to be the directly previous version, it seems to be the first version the browser ever displayed.In Firefox's developer tools it looks like the request actually goes through, but I'm not sure that display is trustworthy, as it also shows an old modification timestamp in the response.
My project is derived from https://github.com/emilk/eframe_template/ and that repo can be used to demonstrate the issue. Simply run trunk serve in it, change something, and see it not being reflected in the browser.
That repo has some additional code that sets up caching, but the bypass in the readme (adding a
#dev
suffix) does not change the problem. I also tried modifying trunk to add a header to prevent caching but it did not solve the issue for me, neither did adding this to the index.html:Disabling the caching in the developer tools has no effect either.
The only thing that did solve issue (but is quite ugly) is to modify the reloading JS to construct and use a new URL that adds a dummy parameter with a timestamp, that way the URL is new and no cached version is used.
I'm running Firefox 135.0.1, rustc 1.85.0 and the latest trunk on Arch Linux. A quick test in Chromium 133 showed the same issue.
/edit:
I might've just solved my problem, it looks like the custom caching code in the template causes the problem. Removing the fetch event listener in the service worker fixes the issue.
Beta Was this translation helpful? Give feedback.
All reactions