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

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

Merged
merged 3 commits into from
Jun 26, 2024

Conversation

Azurewarth0920
Copy link
Contributor

Refs: #732

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

Screen.Recording.2024-06-13.at.23.52.16.mov

Copy link

netlify bot commented Jun 13, 2024

Deploy Preview for pinia-official canceled.

Name Link
🔨 Latest commit 1373b80
🔍 Latest deploy log https://app.netlify.com/sites/pinia-official/deploys/667bde25118c7d0008f0cfe3

Copy link

netlify bot commented Jun 13, 2024

Deploy Preview for pinia-playground failed.

Name Link
🔨 Latest commit 1373b80
🔍 Latest deploy log https://app.netlify.com/sites/pinia-playground/deploys/667bde25fdbb9300088b0d63

@Azurewarth0920 Azurewarth0920 changed the title feat(devtool): expose selected store as feat(devtools): expose selected store as global variable Jun 13, 2024
Copy link
Member

posva commented Jun 14, 2024

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

  • $pinia for the pinia associated with the store
  • $store for the store in question

@Azurewarth0920
Copy link
Contributor Author

Azurewarth0920 commented Jun 14, 2024

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?

Copy link
Member

posva commented Jun 14, 2024

yes

@Azurewarth0920
Copy link
Contributor Author

Azurewarth0920 commented Jun 14, 2024

#2692 (comment)

Implemented in 36a56a8

Copy link
Member

@posva posva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I moved it to globalThis to support more runtimes

Copy link

codecov bot commented Jun 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

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

Additional details and impacted files
@@            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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@posva posva merged commit e0a7351 into vuejs:v2 Jun 26, 2024
9 checks passed
@acabreragnz
Copy link

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.)

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

Successfully merging this pull request may close these issues.

3 participants