Skip to content

Docs: Unclear that MockedProvider short circuits after finding the first query match #13096

@Kangaroux

Description

@Kangaroux

https://www.apollographql.com/docs/react/development-testing/testing#the-mockedprovider-component

New to Apollo and started working on an existing codebase.

I assumed that mocks were applied in order as if they were queries, but actually it's just "whatever mock matches the request first". It ignores any further matches.

This caused some headaches when dealing with tests. We have a default mock object that most tests use. Based on the docs I assumed I could include the default mock and then a follow up with the changes I wanted. But the changes aren't applied because the default is the first match.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions