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
Looking for some clarification about the caching mechanism when using MockedProvier.
I'm observing weird behavior which after hours of digging through the source code is starting to look like it's intended. However, I can't make sense of it.
I've got a flaky test that sometimes throws a No more mocked responses warning. The test is using MockedProvider in the below configuration.
addTypename = true
cache = new InMemoryCache({
possibleTypes: introspection query result from codegen
typePolicies: tripple checked, keyFields matching schema. key field name is id
})
mocks = array or 7 mocks.
defaultOptions = undefined
I do not write any queries to cache for this test.
At first, I thought it was a double render but it quickly became apparent it wasn't. Once I started debugging the test I noticed 2 of the queries 6 unique queries were called twice, the first time would be triggered by the component itself, second, however would be triggered by QueryInfo.prototype.notify (see the below screenshot).
Now what I'm trying to understand, is this behaviour intentional because the cache is empty? I can't spend too much time on this issue hence I'm reaching out to see if someone came accross a similar problem. I've seen a few issues here and there but none of them had enough research backing the explenation of the behaviour.
If I can confirm this is a bug I'd spend some more time on it.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey 👋🏼 ,
Looking for some clarification about the caching mechanism when using MockedProvier.
I'm observing weird behavior which after hours of digging through the source code is starting to look like it's intended. However, I can't make sense of it.
I've got a flaky test that sometimes throws a
No more mocked responses
warning. The test is using MockedProvider in the below configuration.I do not write any queries to cache for this test.
At first, I thought it was a double render but it quickly became apparent it wasn't. Once I started debugging the test I noticed 2 of the queries 6 unique queries were called twice, the first time would be triggered by the component itself, second, however would be triggered by
QueryInfo.prototype.notify
(see the below screenshot).Now what I'm trying to understand, is this behaviour intentional because the cache is empty? I can't spend too much time on this issue hence I'm reaching out to see if someone came accross a similar problem. I've seen a few issues here and there but none of them had enough research backing the explenation of the behaviour.
If I can confirm this is a bug I'd spend some more time on it.
Beta Was this translation helpful? Give feedback.
All reactions