Skip to content

onSuccess not called after upgrading from Expo 51 to 52 #3040

Open
@kuriel-dev

Description

@kuriel-dev

Bug report

Description / Observed Behavior

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

  import useSWRMutation from '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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions