vuejs / pinia

🍍 Intuitive, type safe, light and flexible Store for Vue using the composition api with DevTools support
https://pinia.vuejs.org
MIT License
13.02k stars 1.04k forks source link

feat(devtools): expose selected store as global variable #2692

Closed Azurewarth0920 closed 3 months ago

Azurewarth0920 commented 3 months ago

Refs: #732

Clicking on a store in pinia devtools should make it available as a global variable

https://github.com/vuejs/pinia/assets/22590005/1b6fc1dd-9704-4bea-95cc-8def5f5bbc98

netlify[bot] commented 3 months ago

Deploy Preview for pinia-official canceled.

Name Link
Latest commit 1373b805cb6852cd0e95c27e8af513759d6b6ca8
Latest deploy log https://app.netlify.com/sites/pinia-official/deploys/667bde25118c7d0008f0cfe3
netlify[bot] commented 3 months ago

Deploy Preview for pinia-playground failed.

Name Link
Latest commit 1373b805cb6852cd0e95c27e8af513759d6b6ca8
Latest deploy log https://app.netlify.com/sites/pinia-playground/deploys/667bde25fdbb9300088b0d63
posva commented 3 months ago

This is nice! Maybe $p is too short. I also think we could have 2 properties:

Azurewarth0920 commented 3 months ago

Sorry, I didn't understand, did you mean

  1. Assign the root pinia instance to variable $pinia?
  2. Assign the currently selected store to variable $store?
posva commented 3 months ago

yes

Azurewarth0920 commented 3 months ago

https://github.com/vuejs/pinia/pull/2692#issuecomment-2168089160

Implemented in https://github.com/vuejs/pinia/pull/2692/commits/36a56a88f9b1f461e0d746b711404c810bc73c8c

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 95.46%. Comparing base (67cfd48) to head (1373b80). Report is 279 commits behind head on v2.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## v2 #2692 +/- ## ========================================== + Coverage 94.51% 95.46% +0.94% ========================================== Files 12 11 -1 Lines 3248 2912 -336 Branches 219 189 -30 ========================================== - Hits 3070 2780 -290 + Misses 174 131 -43 + Partials 4 1 -3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

acabreragnz commented 3 days ago

Is this compatible with the new version of the devtools? It seems to not be working. (I didn't try it on the legacy devtools of the video.)