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

Allow writable computeds to be picked up by mapWritableState #2823

Closed
soetz opened this issue Nov 5, 2024 · 1 comment · Fixed by #2847
Closed

Allow writable computeds to be picked up by mapWritableState #2823

soetz opened this issue Nov 5, 2024 · 1 comment · Fixed by #2847

Comments

@soetz
Copy link

soetz commented Nov 5, 2024

What problem is this solving

At the moment, when attempting to use a writable computed (computed({ get () { … }, set (value) { … } })) with mapWritableState, TS reports an error. I assume that this is because mapWritableState, unlike mapState, only allows state and not computeds.

Despite TypeScript complaining, it seems like it does work as expected at runtime (but I did not test extensively).

https://play.pinia.vuejs.org/#eNqNVO9P2zAQ/VeOaFJSKXVATEyqYGKbmMQ+MDSm7cMyiZBci8GxI9tJO5X87zs7Pxo6hNZP9fm9u3vvct4GH6qKNTUGi+DU5JpXFkQmV2dpYE0avE8lLyulLWyhNnhjlUZoYalVCSFLclVLi5pZE06AZVb91Nxmd4IImd0RKi55RshU4sZjC1xmtSBOKgFyVVa1xWLRHQEYY/upoqGJGH6FMowhzDMplb3m+WP4e+Z4bZzKNpWnSaeGFNDBYlkJ4tMJ4JRLKgT2T4VOJm5sGkAzL1WBggK7jKQftluQ0PqEkyRBHHRy59QhezBKkn++7bS/IPNGIWnglbtIGiT+P0NTzu+0Whuy74HA1HUHPadhJAU2Vilh5lnFO9q9tZVZJEleSMJTp7zRTKJNZFUm/3DOT9gJO0oEv0uoUMJlgZvnZYgxL7D8n+wD9PyQHb1l73zW5rhPWrqs3neynWyxJldyyVd7prjhcoH6a2W5ks/NyYRQ6y8+ZnWNY4v5PeaPL8QfzKbr+loj2dfgRJbN9Appnu764ubKz3a8pAnXgtCvXH5Do0TteuxgH2tZUNsTnO/20s+Yy9V3c7GxKM0gyjU6fIW9zZ9ekb5r95gdT1zcLRZZOC4WrQuXe0s47NQIGtYoBo3LGNaZze9HNLUz3T8albG7xT6bVojCvgnasmgGZ7QK3ZY6iiQspY8OaeVc1FeJOphkTSZoXAPLU5RAJtQq6i9n0PbMLt9u5yjxoCDqbSKHXK7+BFTY1lrC7Zttn6297a460wGMI/ibBRiraUwTdi8A1z8cgMpVmTZ4KW3H8G+I+/ElRAcj7OkJuLnKrqIhMnOhA24+k//0Lo3hSSUYrKAih0OwBRQGXwYNSUZsL8t/GL1fvXh6leKpa+67IUTQ/gUzFOyv

Proposed solution

Allow computeds that are writable (WritableComputedRef) to be used within mapWritableState.

Describe alternatives you've considered

No response

@noootwo
Copy link
Contributor

noootwo commented Nov 8, 2024

I'd like to do this, I will make a pull request next week.

It looks like it won 't start until the #2805 is merged.

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

Successfully merging a pull request may close this issue.

3 participants