Skip to content
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

Handling Vuex Store object changes with localStorage #165

Open
nwittwer opened this issue Feb 3, 2020 · 3 comments
Open

Handling Vuex Store object changes with localStorage #165

nwittwer opened this issue Feb 3, 2020 · 3 comments
Labels
Good First Issue Good for newcomers Help Wanted Extra attention is needed Type: Bug Something isn't working

Comments

@nwittwer
Copy link
Collaborator

nwittwer commented Feb 3, 2020

Problem: "Cannot read property 'length' of undefined" (usually for artboards.length).

Current workaround: Try clearing your local storage by opening the DevTools > Application > Local Storage > file:// > and then delete the Reflex key. After reloading the app it should work again.

Cause: This problem typically occurs when the data model for something like artboards has changed, but the view is trying to load data from the localStorage which contains an older format/different properties.

Root cause: Currently we're using the vuex-persist plugin, which saves Vuex Store data in the Electron app's localStorage. When there are changes to the properties or structure of the Vuex Store, this error can occur, because the view is trying to render properties of an object that differ from the localStorage (which was an old copy of the Vuex Store objects).


I am not sure how to avoid this problem currently, and am open to ideas.

One workaround solution could be to add an OS-level menu item that allows users to "Clear localStorage". Or to automatically trigger this function and reload the app if such an error is detected.

@nwittwer nwittwer added Help Wanted Extra attention is needed Good First Issue Good for newcomers labels Feb 3, 2020
@nwittwer nwittwer added this to To do in Stable 1.0.0 Feb 3, 2020
@nwittwer nwittwer added the Type: Bug Something isn't working label Feb 3, 2020
@nwittwer
Copy link
Collaborator Author

nwittwer commented Feb 4, 2020

This could be relevant: https://forum.vuejs.org/t/vuex-using-oop-in-state/63806/3

@nwittwer
Copy link
Collaborator Author

nwittwer commented Feb 10, 2020

Added menu item for clearing Reflex data (localStorage) in a43348e

Reflex > Reset Reflex... > OK

@nwittwer nwittwer changed the title Bug: Cannot read property 'length' of undefined when data model changes Handling Vuex Store object changes with localStorage Feb 10, 2020
@nwittwer
Copy link
Collaborator Author

Related: #205

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue Good for newcomers Help Wanted Extra attention is needed Type: Bug Something isn't working
Projects
Stable 1.0.0
  
To do
Development

No branches or pull requests

1 participant