Skip to content

invalidationBehavior: 'delayed' behavior for sequential mutations #3979

Open
@HarlesPilter

Description

@HarlesPilter

I have created a codesandbox to display the problem.

TLDR: Two sequentially fired mutations that invalidate the same two tags, makes second invalidation wait for first queries to finish.

I have 3 cases displayed there (last one behaves weirdly):

  1. Press the button "Run 1 mutation". Mutation is fired and when it succeeds, it invalidates 2 tags, that in-turn fire short and long queries. Thats all good 👍
    image
  2. Press the button "Run 2 mutations in parallel". Mutation 1 (shorter) and Mutation 2(longer) are fired at the same time.
    image
    They both invalidate the same 2 tags. You can see in the network tab, that the "short" and "long" query fire only when the longer mutation has finished. Thats all good 👍
    image
  3. Press the button "Run 2 mutations sequentially".
    image
    The second mutation is called when the first one is completed. But because the first mutation is completed the two tags are invalidated and "short" and "long" queries are also fired. Even when the second mutation completes, it waits for both "short" and "long" query to finish, to invalidate its tags and re-fire "short" and "long" queries to get the latest state from BE. Thats bad 👎
    image

I think the current behaviour for sequential mutation is not correct.
Options how it could be better:

  • Option1
  • Option2
  • Option3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions