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: destroy a store with $dispose #597

Merged
merged 2 commits into from
Aug 19, 2021
Merged

feat: destroy a store with $dispose #597

merged 2 commits into from
Aug 19, 2021

Conversation

posva
Copy link
Member

@posva posva commented Aug 4, 2021

Close #557

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)
  • All tests are passing
  • New/updated tests are included

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

@codecov
Copy link

codecov bot commented Aug 13, 2021

Codecov Report

Merging #597 (8c50e19) into v2 (2b3aa5f) will increase coverage by 0.11%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##               v2     #597      +/-   ##
==========================================
+ Coverage   89.70%   89.81%   +0.11%     
==========================================
  Files           9        9              
  Lines         369      373       +4     
  Branches       99       99              
==========================================
+ Hits          331      335       +4     
  Misses         14       14              
  Partials       24       24              
Impacted Files Coverage Δ
packages/pinia/src/types.ts 100.00% <ø> (ø)
packages/pinia/src/store.ts 87.44% <100.00%> (+0.22%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2b3aa5f...8c50e19. Read the comment docs.

@posva posva merged commit a563e6a into v2 Aug 19, 2021
@posva posva deleted the feat/dispose branch August 19, 2021 11:01
@sabifa
Copy link

sabifa commented Nov 20, 2023

How am I supposed to use disposePinia? It seems like I can't import it in any way.

@eastmann
Copy link

How am I supposed to use disposePinia? It seems like I can't import it in any way.

It seems you should distructure $dispose from your store instance:

import { onUnmounted } from 'vue'
import { useYourStore } from '@/stores/YourStore'
...
const { $dispose } = useYourStore()
...
onUnmounted(() => {
    $dispose()
})

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.

Add ability to destroy stores
3 participants