RaspberryPiFoundation / editor-ui

Code Editor web component
https://editor-static.raspberrypi.org
Apache License 2.0
37 stars 8 forks source link

Changes to projects you don't own show up at original project URL #1001

Closed floehopper closed 2 months ago

floehopper commented 2 months ago

Steps to reproduce:

  1. Login
  2. Visit a project you do not own (e.g. https://editor.raspberrypi.org/en/projects/hello-world-starter)
  3. Edit the code
  4. Save the project (thus remixing it)
  5. Visit the original project URL again (i.e. https://editor.raspberrypi.org/en/projects/hello-world-starter)
  6. See your changes in the code when you should see the original version of the code

https://github.com/RaspberryPiFoundation/editor-ui/assets/3169/824e4558-3457-4137-9988-10b6c2eeb7b6

This is happening because after step 3 the auto-save functionality stores the project (with your code changes) in local storage against the original project identifier. When the project is saved, the remixed version is created in the database, but the cached version is left in local storage. When you re-visit the original project URL, the project cached in local storage is loaded, because the URL path matches the local storage key, i.e. the original project identifier.

create-issue-branch[bot] commented 2 months ago

Branch issues/1001-Changes_to_projects_you_don_t_own_show_up_at_original_project_URL created!