new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

TanStack Query · React · all subjects

comparison/mutations

4 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Automatic refetch after mutation requires schema

For truly automatic refetching to happen after a mutation occurs, a schema is necessary (like the one GraphQL provides) along with heuristics that help the library know how to identify individual entities and entity types. React Query marks this as supported but requiring extra user-code.

Mutation filter object properties

A mutation filter object supports the following properties: - mutationKey (optional, MutationKey): defines a mutation key to match on. - exact (optional, boolean): when true, returns only mutations with the exact mutation key provided; defaults to false for inclusive search. - status (optional, MutationStatus): allows filtering mutations according to their status. - predicate (optional, function): takes a Mutation and returns boolean; used as final filter on all matching mutations.

MutationFilters usage examples

Example usage of mutation filters: ```tsx // Get the number of all fetching mutations await queryClient.isMutating() // Filter mutations by mutationKey await queryClient.isMutating({ mutationKey: ['post'] }) // Filter mutations using a predicate function await queryClient.isMutating({ predicate: (mutation) => mutation.state.variables?.id === 1, }) ```

matchMutation utility function

The matchMutation utility function returns a boolean indicating whether a mutation matches the provided set of mutation filters. Usage: `const isMatching = matchMutation(filters, mutation)`

Give your agent this brain