-
Notifications
You must be signed in to change notification settings - Fork 600
mutations are typed correctly #8122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
The types for the mutation hooks where defined loosely and outside their value declarations. This lead to the hooks being mistyped by mistake. - Move the hooks types to where the hook functions are. - Strengthen the types so that we don't mistype by accident.
promise = dispatchResult; | ||
const result = await promise.unwrap().catch((error) => { | ||
onError?.(error, queryArg); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't swallow the error
} catch (error: unknown) { | ||
if (onError && isTauriCommandError(error)) { | ||
onError(error, queryArg); | ||
} | ||
throw error; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On error is called, but the error is thrown still
} | ||
|
||
return result; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't return the dispatch result
const result = await dispatchResult.unwrap(); | ||
sideEffect?.(result, queryArg); | ||
return result; | ||
} catch (error: unknown) { | ||
if (onError && isTauriCommandError(error)) { | ||
onError(error, queryArg); | ||
} | ||
throw error; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return the mutation result or throw
The types for the mutation hooks where defined loosely and outside their value declarations. This lead to the hooks being mistyped by mistake.