-
Notifications
You must be signed in to change notification settings - Fork 19
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
Refreshing page after updating content results in stale data #4
Comments
Are you sure your updating the service worker? Refreshing the page won't update it, you'll need to do it from the dev tools on chrome or about:serviceworkers on firefox Edit: Also which content? the planktos scripts or the website's content? |
If a real website is being served from planktos and an update is made, when the user refreshes they should receive the changes, right? For development, I agree that updating the service workers on refresh works. |
oh I see, yeah that's right. Those kind of changes will only be reflected if the torrent is updated after the file is changed. Auto checking the .torrent file to see if it has changed hasn't been done though. As of right now, it's only updated when the service worker is installed, but it is possible to manually check for an updated .torrent without re-installing the service worker. |
Then it seems like a good idea to check for an updated .torrent file on every page load |
I'm thinking every page load may be needlessly excessive.. I don't know though |
After thinking about it more:
No solution really stands out as a winner though.. Some ideas:
|
Not auto updating when the website's torrent is recreated is problematic. A non-blocking request to the manifest.json/root.torrent on every page seems like a good way to fix this. |
To Summarize our Conversation Yesterday: After every page load Planktos will check for an updated torrent in a non-blocking way, updating the torrent if changes have been found. This means that any network requests coming after the torrent has been updated will load assets from the updated torrent. This approach may be problematic if the user makes network requests after updating the torrent and before refreshing the page again, resulting in parts of the page being loaded from the old torrent and parts from the new torrent. This can be solved by remembering which torrent was used for the current page load, downloading the new torrent without overwriting the old one, and swapping the torrents on the next page load. This means that the new torrent will only be visible to the user on the second refresh. This will eventually be the default way to update the torrent, but, for now, we are going to implement the naive approach first. Additionally, since both of these methods result in loading stale data, it would be good to offer the blocking option as well. This could be manually specified in some configuration. |
@xuset Can you tackle the initial implementation for this? I think it should be accomplished before we get our first round of feedback. |
To implement the blocking auto-update: the service worker should immediately call update() when it is initialized and fetch requests should wait for the update promise to fulfill before sending the requests to fetch() |
It looks like updated content is not recognized, resulting in stale data being loaded, even if the server is serving new content.
Deleting locally stored content seems to fix the issue.
The text was updated successfully, but these errors were encountered: