posva / pinia-colada

๐Ÿน The smart data fetching layer for Pinia
https://pinia-colada.esm.dev/
MIT License
584 stars 7 forks source link

feat: add mutation plugin #46

Open quiteeasy opened 1 month ago

quiteeasy commented 1 month ago

Close #15

This pull request introduces the initial implementation of the mutation plugin.

I noticed a couple of TODOs in the code (specifically in the useMutation hook, stating "TODO: move to plugin"). However, I am uncertain about moving the method responsible for invalidating cache entries to the plugin.

Relocating this functionality to the plugin would require passing mutation-scoped variables like vars and newData. This could potentially introduce coupling and complexity, as these variables are specific to individual mutations. Additionally, I'm uncertain about the tangible benefits of this approach.

Discarding cache entries within each respective mutation implementation might be more cohesive and aligned with the principle of separation of concerns.

I would appreciate your thoughts and feedback on this matter. Please share your perspective on the trade-offs and potential implications of moving the cache invalidation logic to the plugin versus keeping it within the mutation implementations.

netlify[bot] commented 1 month ago

Deploy Preview for funny-banoffee-0afb46 canceled.

Name Link
Latest commit 83c37a2b35e7e3824967e41b871ed5d977afae0e
Latest deploy log https://app.netlify.com/sites/funny-banoffee-0afb46/deploys/664b2788af92290008c374b5
posva commented 1 month ago

Thanks! The todo was referring to another kind of plugin, something not yet in the codebase. Some todos are not explicit enough ๐Ÿ˜… I appreciate the effort thought ! I will try to rework the PR to give you a review