reflex-app / reflex-app/reflex

Handling Vuex Store object changes with localStorage

Open
#165 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Good First Issue Help Wanted Type: Bug
Dominant language
Vue
Stars
34
Forks
1
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names Vuex persistence through the Electron app's localStorage and the Reflex key, but no source files or tests. Start by locating the vuex-persist setup and the code that reads artboards, then define how older stored data should be handled and verify that the app no longer fails after a store shape change.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, nuxt
Domain
desktop, frontend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.