The proper way to manage deep state with pinia? #1498
Unanswered
GoodManWEN
asked this question in
Help and Questions
Replies: 1 comment 1 reply
-
You don't need to do anything specific. The object being a proxy is just how Vue tracks its reactivity. You probably need to check if dirName exists: |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone, I am using pinia to complete a small project written by vue3. When I needed to manage a complex structure, I found that I could not access them directly in the method, for example,
The above is a minimal implementation, which uses a sophisticated state. The problem I'm having is that the above code can access
this.fileStruct[dirName]
but will throw aUncaught TypeError: Cannot read properties of undefined (reading 'store')
error when it comes tothis.fileStruct[dirName].store
. I noticed that pinia's state is a proxy but not a normal object, how do I use actions to properly modify these deep statuses? Any help will be greatly appreciated!Beta Was this translation helpful? Give feedback.
All reactions