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

Multi mutation hook #128

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

tsiotska
Copy link

@tsiotska tsiotska commented Dec 7, 2024

Adresses #88

Change log:

  • 'useMultiMutation' hook
  • playground test: deletion and creation of contact
  • mutation store readability refactoring without tests break

Copy link

netlify bot commented Dec 7, 2024

Deploy Preview for funny-banoffee-0afb46 canceled.

Name Link
🔨 Latest commit cdc638b
🔍 Latest deploy log https://app.netlify.com/sites/funny-banoffee-0afb46/deploys/6761fa2a8c8be10008f0580e

Copy link
Owner

@posva posva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I think this should be doable without touching much the mutation store but it might also be missing a few things yet.
If you want, you can give it a try without adding new actions to the mutation store

@tsiotska
Copy link
Author

tsiotska commented Dec 8, 2024

I want, once I ensure base multi mutation works I plan to take a deeper look into the missing essential Mutation features, including:

  • gcTime (garbage collection for stale cache)
  • Requests batching
  • Persisting cache (e.g., local storage)
  • Automatic request retry
  • Global loading indicator (e.g., isGlobalMutationLoading)
  • networkMode
  • Cancel hook etc.

@posva
Copy link
Owner

posva commented Dec 9, 2024

I'm happy to have more contributions! Most of these are planned as plugins to keep the library to the most used features and keep it lean. gcTime is already implemented. Network mode I'm not sure about its utility. It should be doable as a plugin with a couple of small additions to the stores but I'm not even sure it's worth it. Do you have use cases where this feature proved to be critical?

@tsiotska
Copy link
Author

tsiotska commented Dec 9, 2024

TanStack has abstraction with options for both query and mutation. I might be quite misled, but we have gcTime as part of UseQueryOptions interface and UseMutationOptions lacks some properties like gcTime. (We should also pay attention that queryClient is missing and maybe it would make lot's of reconstruction if being postponed).

Copy link
Owner

posva commented Dec 9, 2024

The goal is not to copy tanstack query. Every feature I add is based on a need that I personally validated. When something is not as common, I push it into a plugin. This way the library is kept small and efficient

@tsiotska tsiotska requested a review from posva December 18, 2024 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 Triaging
Development

Successfully merging this pull request may close these issues.

2 participants