Closed matt-dalton closed 1 year ago
Ahh...after some digging around in the source code I realised this was because I was using environment.clearCache
instead of environment.mockClear
in my test's beforeEach
.
In case someone runs into anything similar, to solve some similar issues I also had to properly reset my environment between each test using createMockEnvironment
.
I have a slightly confusing situation that's causing a problem in a test, but possibly might happen outside of tests also.
My code looks like this (using v5.0.0 of react-relay-offline):
I run one test fine, switching from one test to the other I run:
then the second test I get this sequence of logs:
If I switch the tests round I get the same thing on the second test. So I think there must be some state persisting between the stores (or a mock not being rest somehow)
I appreciate I haven't shown you any of the code around this (I didn't want to overwhelm with information just yet), but are you aware of a situation that could occur where
isLoading
changes from true -> false even though no data is returned yet, before then loading a couple of cycles later? It looks to me like there's an operation logged in Relay the entire time as well.Is there anything I could log from the store (or elsewhere) that might help debug this?
I have seen the odd random error screen flash in our app, which makes me wonder if this also happens outside of tests.