open-scd icon indicating copy to clipboard operation
open-scd copied to clipboard

Local stored plugins are not automatically updated when there is a new version of open-scd

Open juancho0202 opened this issue 11 months ago • 2 comments

Describe the bug If an OpenSCD user still have an old version of the plugin configuration in the local storage, OpenSCD will be broken. The user has to go clear the local storage manually to fix this problem.

To Reproduce Steps to reproduce the behavior:

  1. Release a new version of OpenSCD where a plugin has new functionality or a fixed bug
  2. Navigate to openscd.github.io
  3. Check your plugin to validate the expected modification
  4. See old behavior pre-release
  5. Go to developer tools in the browser
  6. Remove local storage manually
  7. See new behavior

Expected behavior The local storage need to be updated/reloaded with the latest version of OpenSCD. This should be an automatic process.

juancho0202 avatar Mar 06 '24 09:03 juancho0202

I did a little curiosity research which may or may not help:

We could use a file to remove cache control but in general we want caching (see here]

Notionally Github pages is only cached for 10 mins (see here)

It seems like we could update our cache control headers in our index file as per this comment

<meta http-equiv='cache-control' content='no-cache'> 
<meta http-equiv='expires' content='0'> 
<meta http-equiv='pragma' content='no-cache'>

That would be if it's a Github Pages issue.

Perhaps the other likely cause is some kind of PWA caching.

The following thread suggests we should make sure the version in our manifest.json is updated when a new release occurs.

I note that our package.json and our manifest.json are not currently in synch so that may be related and is probably where I would start.

https://github.com/openscd/open-scd/blob/f30e344d415c672345b5b20a231db1c20840b902/packages/open-scd/manifest.json#L42-L44

https://github.com/openscd/open-scd/blob/f30e344d415c672345b5b20a231db1c20840b902/packages/open-scd/package.json#L1-L4

danyill avatar Mar 08 '24 07:03 danyill

Talked about it in refinement @danyill, that is a different problem. The problem we have is for example if we add a new official plugin it is not added automatically to OpenSCD. The user has to clear the local storage so it gets reinitialized.

Our suggestion is to compare the plugins.js's array with the one stored in local storage:

  • if there is a new one, just add it to array in local storage
  • and if removed a plugin then we also remove it from the local storage

This was the manually added plug-ins can stay and you don't have to add them again.

trusz avatar Mar 12 '24 08:03 trusz