vuejs / pinia

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

Could add a destructuring method contains actions and non reactive property? #2680

Closed Sorryhx closed 1 month ago

Sorryhx commented 1 month ago

What problem is this solving

In my opinion, it's messy when I want to destructure acitions from store at the same time as state. Because, I need to add a alone constant for storeToRefs and action destructuring. Why not destructure from useXXXStore direcly.

Proposed solution

const { aciton, reactiveState } = someDestructureMethod(useXXXStore())

Describe alternatives you've considered

No response

posva commented 1 month ago

Most of the time, it’s shorter to my déstructure. This would add new method to reduce from two lines to one. It’s something that can be built in user land for projects that need it thought