Closed ysgk closed 4 years ago
Intended outcome: One can handle errors that occur in refetchQueries.
Actual outcome: They cannot be caught.
How to reproduce the issue:
https://github.com/ysgk/react-apollo-error-template/tree/ysgk
Please run the app above and push the Logout button. You can confirm that errors cannot be caught in the catch block, nor in the onError callback.
onError
const [logoutMutation, logoutResult] = useMutation(LOGOUT, { onError: () => { console.log('This line never gets called.') }}) const logout = () => logoutMutation({ awaitRefetchQueries: true, refetchQueries: [ { query: ALL_PEOPLE }]}).catch((e) => { // Errors that occur in refetchQueries cannot be caught. console.log('This line also never gets called.') })
Version
System: OS: macOS 10.15.5 Binaries: Node: 12.18.1 - ~/.nodebrew/current/bin/node Yarn: 1.22.4 - ~/.nodebrew/current/bin/yarn npm: 6.14.6 - ~/.nodebrew/current/bin/npm Browsers: Chrome: 83.0.4103.116 Edge: 83.0.478.64 Firefox: 77.0.1 Safari: 13.1.1 npmPackages: @apollo/client: ^3.0.0 => 3.0.0
Sorry, I found this was a duplication of https://github.com/apollographql/apollo-client/issues/3631
Intended outcome: One can handle errors that occur in refetchQueries.
Actual outcome: They cannot be caught.
How to reproduce the issue:
https://github.com/ysgk/react-apollo-error-template/tree/ysgk
Please run the app above and push the Logout button. You can confirm that errors cannot be caught in the catch block, nor in the
onError
callback.Version