You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MockedProvider returns error (No more mocked responses) when using cache-and-network fetchPolicy (initial render is ok but then re-render with error is triggered)
#7669
Open
WojciechKulpa opened this issue
Feb 8, 2021
· 1 comment
MockedProvider should return correct data based on provided mocks without error.
Actual outcome:
After initial correct render components are re-rendered with error from MockedProvider (No more mocked responses for the query...)
How to reproduce the issue:
CodeSandbox: https://codesandbox.io/s/green-glitter-ynlk0
Important is fact that we are rendering two components that are using the same query with different variables.
After initial successful render components are re-rendered but this time with error about missing mock (that was returned correctly in first render). Steps after sleep are failing (without sleep test was sometimes passing if it was finished before re-render).
The same test works good on 3.3.0 before beta.11. Results on beta11 are a bit different than on e.g. 3.3.8 as on beta11 test are failing also in first part but starting with 3.3.0-rc.3 it looks like initial renders are ok and only first component is re-rendered with error (same behavior reproduced on 3.3.7 and 3.3.8).
Versions
3.3.0-beta.11 and later (3.3.0-beta.10 works good)
The text was updated successfully, but these errors were encountered:
I've seen this also with apollo client 3.3.5. Doesn't it make sense though, as in, on every render it should hit the network again (since it's not cache-first). If you want to only hit the network and cache on the first render after a mount, shouldn't you set nextFetchPolicy to cache-first?
Intended outcome:
MockedProvider should return correct data based on provided mocks without error.
Actual outcome:
After initial correct render components are re-rendered with error from MockedProvider (No more mocked responses for the query...)
How to reproduce the issue:
CodeSandbox: https://codesandbox.io/s/green-glitter-ynlk0
Important is fact that we are rendering two components that are using the same query with different variables.
After initial successful render components are re-rendered but this time with error about missing mock (that was returned correctly in first render). Steps after sleep are failing (without sleep test was sometimes passing if it was finished before re-render).
The same test works good on 3.3.0 before beta.11. Results on beta11 are a bit different than on e.g. 3.3.8 as on beta11 test are failing also in first part but starting with 3.3.0-rc.3 it looks like initial renders are ok and only first component is re-rendered with error (same behavior reproduced on 3.3.7 and 3.3.8).
Versions
3.3.0-beta.11 and later (3.3.0-beta.10 works good)
The text was updated successfully, but these errors were encountered: