Getters in devtools #435
Closed
marshallswain
started this conversation in
Ideas
Replies: 1 comment 3 replies
-
I'm glad you are enjoying Pinia! 😄 I think we can add an internal property to the store only in dev mode for the getters |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I find that being able to see the getters in the devtools is really valuable for debugging. There's not really a performance downside on the apps that I build, but would rather discuss before making a PR.
The cleanest, most-maintainable way I can see would be to add an array of the getter property names to the root level of the store here: https://github.com/posva/pinia/blob/v2/src/store.ts#L226
Then a third group of fields can be added to the
formatStoreForInspectorState
function, here: https://github.com/posva/pinia/blob/v2/src/devtools.ts#L169. I did a quick change topinia.esm-browser.js
innode_modules
with the following change (Note: I should have seteditable
tofalse
for getters):The result works as expected:
@posva, if you are open to this approach, I will create a PR. Thanks for building
pinia
. The API is nice and clean and easy to use.Beta Was this translation helpful? Give feedback.
All reactions