Feature request: subscribeAction()
See original GitHub issueVueX has an option to subscribeAction
. I think it would be even more relevant here. Pinia currently has subscribe()
but it’s just a simple wrapper over watch()
and it often might not be precise enough.
Subscribing to actions would be more explicit.
https://vuex.vuejs.org/api/#subscribeaction
store.subscribeAction((action, state) => {
console.log(action.type)
console.log(action.payload)
})
Usecase:
In many places in the code you might want to react to userStore.state.isLoggedIn
. Current store.subscribe()
may fire multiple times, you’d need to check for truthy value of loggedIn, check if it’s different from previous value and so on.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:16 (8 by maintainers)
Top Results From Across the Web
Feature request: subscribeAction() · Issue #240 · vuejs/pinia
VueX has an option to subscribeAction . I think it would be even more relevant here. Pinia currently has subscribe() but it's just...
Read more >Subscribe - Amazon Simple Notification Service
Subscribes an endpoint to an Amazon SNS topic. If the endpoint type is HTTP/S or email, or if the endpoint and the topic...
Read more >Bountysource
Feature request : subscribeAction() ... Help and Information. Frequently Asked Questions · Bugs and Feature Requests · Fees ...
Read more >Feature Request Content - Instabug
This page covers the content found in a feature request. Suggest Edits. Users can add new feature requests or comment on existing ones....
Read more >API Reference | Vuex
The subscribeAction method will return an unsubscribe function, which should be called when the subscription is no longer needed.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The API has been documneted
@posva Use case: making plugins like persistance, logging, etc.