Open LucasHimelfarb opened 3 months ago
I fear this is way too specific for any of us to reproduce and look at - if you can build some more generic reproduction that we can actually run, we could take a look, but like this I'm not sure we can help you, sorry :/
@phryneas It s a company project so is hard to share a reproducible case for u. But I swear my implementation is so simple like that. May be is useful look my root navigator:
@phryneas and funny fact: if I remove all code lines on queryFn and just return an empty array the problem persist
Can you tell us what version of Redux-toolkit, React-Redux, React-Native and React you're running? Maybe that'll give some sort of clue as to where the issue is coming from.
@aryaemami59 of course...
"@reduxjs/toolkit": "2.2.5"
"react-redux": "9.1.0",
"react-native": "0.73.5",
"react": "18.2.0",
after many hours trying different approaches I can't get it... I think it is a bug related between RTKQuery and react-navigation/native
@LucasHimelfarb Can you add this to your package.json
's dependencies and try again?
"@reduxjs/toolkit": "https://pkg.csb.dev/reduxjs/redux-toolkit/commit/d86ec94b/@reduxjs/toolkit",
Thanks for u suggest @aryaemami59
Getting the same behavior :/
@LucasHimelfarb this is a longshot, but can you also try with the most recent React-Redux version?
@aryaemami59 I tried it together with the last thing you shared with me and with the latest version of react-redux (9.1.2) and I get the same behavior
@LucasHimelfarb Then in that case, I think our best bet is if you put together a small repro, I understand it's probably time consuming, but it's very difficult to tell what's going on without having a sample of the problem to look at.
Hello when a navigator stack is replaced, is it possible that the mutation state is lost or reset ?
@aryaemami59 In this week I can't build a repo to reproduce the error because my job... but I'll try to do it on the weekend.... @Almada2021 I think no, I don't see any repeat log or actions dispatched twice
@LucasHimelfarb Awesome. Let me know when you do so I can take a look.
I am facing this same issue. I will also note that uninitialized is true
. @LucasHimelfarb if you console.log isUninitialized
, is it true? You can export if from your mutation dict along with isLoading
, isError
, etc...
Might this be related? I would try rolling back to v2.2.3
to confirm that v2.2.4
changes is the cause if the issue here.
@aryaemami59 new update: this happened only with queryFn thats not return a string as a data
@LucasHimelfarb sorry you said this only happens if queryFn
returns something other than a string? Do you have a small example or maybe even a code snippet? I can take a closer look, I just need to know what to look for.
In my React Native application, I implement React Navigation and have two stack navigators... After replacing one with the other, a screen is rendered that will make two requests using RTK Query. The first is a simple query to obtain some authorization tokens, which resolves without any issues. The second is a mutation that implements a queryFn...
and those queries called in my screen:
But the getCredits mutation never resolve with success even if the requests defined in queryFn was resolved, the data value is unfilled in the screen side and the flag isLoading is always true.
All works fine when the replace of stack navigators never happens