Skip to content

Conversation

@hervedombya
Copy link
Contributor

@hervedombya hervedombya commented Feb 16, 2024

This pull request introduces a new feature that allows chaining of mutations in the application. The changes involve exporting a new function useChainedMutations from src/index.ts and creating a new file src/useChainedMutations.tsx that contains the implementation of this function. The useChainedMutations function uses React's useRef hook and several TypeScript utility types to handle the chaining of mutations.

The most important changes are:

  • src/index.ts: The useChainedMutations function has been exported to be used in other parts of the application.

  • src/useChainedMutations.tsx: This new file contains the implementation of the useChainedMutations function. This function takes an array of mutations and a function to compute the variables for the next mutation in the chain. It returns an object containing a mutate function that triggers the chain of mutations, a computeVariablesForNext function that computes the variables for the next mutation, and an array of mutationsWithRetry that includes a retry function for each mutation. Several TypeScript utility types have been defined to handle the chaining of mutations, including ChainedMutation, InferChainedMutation, ChainedMutationsResults, ExtractVariables, ExtractData, ExtractKey, ExtractDataFromChainedMutaionTuple, ComputeVariablesForNextBuilder, and ComputeVariablesForNext.

Add .babelrc and update package.json and README.md
@hervedombya hervedombya merged commit 9c749c7 into main Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants