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
onSuccess option is not called after upgrading from Expo 51 to 52
react: 18.3.1
expo: 52.0.4
Expected Behavior
onSuccess to be called after fetcher promise is resolved (WORKS on Web, the bug occurs on Android)
Repro Steps / Code Example
importuseSWRMutationfrom'swr/mutation';const{data: pokemons,trigger: getPokemons,isMutating: isLoading}=useSWRMutation(url,{onSuccess: (result)=>console.log(result),// not called // before upgrading this worked});useEffect(()=>{getPokemons();},[]);
Additional Context
swr: 2.2.5
There is a chance this error is related to the new React Architecture since hooks also stop to propagate fetcher results.
in order to use the new React Architecture with Expo, create an Expo 52 project and add/update this line in app.json:
"newArchEnabled": true,
Under { "expo": { here } }
Re-launch app after clearing cache.
The text was updated successfully, but these errors were encountered:
Adding a .then() to the fetcher seems like axios is correctly making the call and correctly returning the response to swr.
Happens very intermittently, some calls work just fine and some don't. Seems pretty random, doesn't seem related to a certain endpoint. When that happens, onSuccess is indeed not called and the data returned by the swr hook is always undefined.
EDIT: lookin at the changelogs it seems that the last release for swr was in February and this issue has been a fairly recent(last couple of weeks) thing for us. Which makes me wonder if perhaps a peer deps or something that swr depends on might have introduced some kind of bug that makes this happen. 🤔
EDIT2: Could it be related to the latest android versions I wonder 🤔. Happens also on a tablet emulator on android 11.0 ("R") | x86 API 30
Phone/tablet, physical device/emulator doesn't seem to make a difference either.
Bug report
Description / Observed Behavior
onSuccess option is not called after upgrading from Expo 51 to 52
Expected Behavior
onSuccess to be called after fetcher promise is resolved (WORKS on Web, the bug occurs on Android)
Repro Steps / Code Example
Additional Context
swr: 2.2.5
There is a chance this error is related to the new React Architecture since hooks also stop to propagate fetcher results.
in order to use the new React Architecture with Expo, create an Expo 52 project and add/update this line in app.json:
"newArchEnabled": true,
Under
{ "expo": { here } }
Re-launch app after clearing cache.
The text was updated successfully, but these errors were encountered: