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

Pinia stores with data are empty objects {} in DevTools #575

Closed
simensol opened this issue Aug 23, 2024 · 2 comments
Closed

Pinia stores with data are empty objects {} in DevTools #575

simensol opened this issue Aug 23, 2024 · 2 comments
Labels
need reproduction Reproduction is needed

Comments

@simensol
Copy link

simensol commented Aug 23, 2024

When I load my app, the data is fetched and the stores are populated as expected:

Eisi Eisi

However, when I inspect the Pinia stores in the DevTools, all stores are empty objects {}:

Eisi

I have tested in both Chrome v128.0.6613.84 and Safari v17.6. I have tested with the latest Vite Plugin and Chrome extension, and the result is the same.

Environment:

  • Vite v5.4.2
  • Pinia v2.2.2
  • macOS v14.6.1
@webfansplz
Copy link
Member

Hi, Can you provide a mini repo?

@webfansplz webfansplz added the need reproduction Reproduction is needed label Aug 25, 2024
@simensol
Copy link
Author

I have resolved the issue where the Pinia stores appeared as empty objects {} in the DevTools, despite being populated correctly in the application.

The problem was related to the reactivity of the state objects. Specifically, when transforming the state using methods like Object.keys().filter().reduce(), the reactivity was lost.

To fix this, I ensured that the transformed state objects were wrapped with reactive from @vue/reactivity. This preserved the reactivity and allowed the stores to be correctly displayed in the DevTools:

DevTools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need reproduction Reproduction is needed
Projects
None yet
Development

No branches or pull requests

2 participants