What happens if demo files are updated and a user has already visited the site
Opened this issue ยท 5 comments
If a user has visited the site from a particular browser and then revisits the demo site at a later time, perhaps noticing from the repo that additional demo examples have been added, or original examples have been updated, how will their browser respond?
- will new files be added to browser storage (which already has state associated with the demo URL)?
- will updated files overwrite similarly named files in browser storage?
How could a user "update" their local state to reflect the current repo live demo state? (I guess one way might be to run the browser as a new private browser session, but how many folk would think to do that?)
Thanks @psychemedia.
The way it works for now if the jupyterlite is able to fetch the initial content (generated via jupyter lite build --files content
) and show it in the file browser.
If new files are added to the repo and deployment, they should normally show up automatically.
If a user opens one of these files, modifies it and save it, it will persist in local storage. Next time the page is loaded it will still be the user's copy. If they delete the file (for example with right-click), the file will revert to the original (generated with --files
).
Maybe we should have some docs about this to help clarify.
"If they delete the file (for example with right-click), the file will revert to the original (generated with --files)."
So is this like some sort of "transparent mount", where a user can work in a "user layer" editing files etc but if they delete a file that was in edited user storage area it reappears from the provided/default files layer when they reload the environment.
To clarify: if I edit, save and delete a provided/shipped file in a browser session, if I hard refresh the browser, the deleted file will reappear? If I just delete a shipped file without changing it, will it reappear after a reload too?
Related are the semantics of the File menu options from an open notebook Reload Notebook from Disk
and Revert Notebook to Checkpoint
. The checkpoint is presumably in browser storage? Is just one checkpoint file supported? In what senses might the shipped file be regarded as "the original checkpoint" and in what senses might that be confusing/cause misunderstanding?
Normally it should be possible to test these scenarios and see what happens?
if I edit, save and delete a provided/shipped file in a browser session, if I hard refresh the browser, the deleted file will reappear?
Not the deleted files, but the original shipped file should appear.
If I just delete a shipped file without changing it, will it reappear after a reload too?
This should be like a no-op for now, and the file will still be visible in the file browser.
The checkpoint is presumably in browser storage? Is just one checkpoint file supported? In what senses might the shipped file be regarded as "the original checkpoint" and in what senses might that be confusing/cause misunderstanding?
It's in the browser storage yes. It was added in jupyterlite/jupyterlite#47 and keeps 5 versions.
This already caused confusion for me, too. I put up a site for my grad class using Jupyter Lite and GitHub pages, and when I updated the notebook via git, I kept getting the old version. I think this is a place that some notifications would be really helpful like:
- when a user first saves their notebook, alert them that the notebook will be saved to local browser storage on their machine, and future visits to this page will open their saved work
- when the notebook in the repository is updated, offer users the option to load their previous version or load the latest version from the repository
It might also make sense to have a new menu item "Revert Notebook from Repository" or "Load Notebook from Repository" or similar; if it can specifically put "GitHub" instead of "Repository" when run from GitHub pages, that will be even more clear for users. It wasn't clear to me what disk that "Reload Notebook from Disk" referred to -- I thought it might get me the latest from the repository.