Skip to content

Mutation cache does not contain the mutationFn key #3618

@sandergo90

Description

@sandergo90

Describe the bug

Hi!

I'm currently implementing offline support for my application using the v4 version but I'm having a problem with the mutation cache.

It seems that in the hydration.js file, the mutationFn is returned in the dehydrateMutation function. This is causing the warning No mutationFn found.

Your minimal, reproducible example

Not able

Steps to reproduce

  1. Open your application while online
  2. Go offline and do some mutation that's supposed to be persisted and resumed when going online
  3. Close your application fully
  4. Go back online
  5. Open your application again
  6. Call queryClient.resumePausedMutations(); inside the onSuccess function of the PersistQueryClientProvider
  7. Warning is shown, and the mutation is not executed.

Expected behavior

I expect my mutation to be cached correctly, and I expect the mutation function to be executed when resumed.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

iOS, Android

react-query version

4.0.0-beta.5

TypeScript version

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions