Michael "Mike" Ferris

Results 77 comments of Michael "Mike" Ferris

Here are my findings so far (no repro still -_-) I have a query on some page and it is set as "dirty" at some point https://github.com/apollographql/apollo-client/blob/d914d689abd9a3364cfa9c6bef8617d97df67a1c/src/core/QueryInfo.ts#L229-L234 Then the query...

Alright after going through this whole effort, I managed to make my minimal repro work!!

@jerelmiller Great to hear! I was about to open a PR then figured I should write a test for this. However, I can't figure out how to reach the state...

So I'm not 100% sure why, but my current investigation leads me to this bit of code where `InternalState.useObservableQuery` will call `this.client.watchQuery` twice for the same query (can be seen...

It does look like StrictMode is the offender in the repro above where `useRef` in `useInternalState` is empty on both renders causing to create an ObservableQuery twice It would point...

My biggest fear is that there's a memory leak somehow. I haven't been able to confirm it either in a repro nor in our production application, so I suppose that...

@jerelmiller Someone on my team, @lorenzopicoli , found another related issue. In one of our mutations, we're using the `refetchQueries` option ```ts const [mutation] = useMutation( createAssetMutation, { ignoreResults: true,...

I dug a bit more into it. From what I can see here's what happen (exacerbated by StrictMode, but possible without) - useQuery is called - client.watchQuery is called creating...

So clearly StrictMode is being a huge offender of this problem. I can see that the useState initializer function runs twice in StrictMode https://github.com/apollographql/apollo-client/blob/80471816396fa023fa2dc3b768ceb3da5b22edf4/src/react/hooks/useQuery.ts#L179-L205 https://react.dev/reference/react/useState#caveats Since there's no proper "cleanup"...

Now I'm starting to wonder if the main issue was fixed (aka dead queries in production) When I initially encountered this issue we were on apollo-client 3.10.4, we are currently...