-
Notifications
You must be signed in to change notification settings - Fork 135
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
feat: add useLogout hook #566
Conversation
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.
Same comment here about adding a doc to this PR.
Let's get in the habit of adding docs with code changes
e5ad797
to
7144c68
Compare
7144c68
to
00c9eb0
Compare
5ca33c5
to
62dc715
Compare
00c9eb0
to
58597f8
Compare
62dc715
to
3d33dbe
Compare
4ab6722
to
7cb782b
Compare
69b045b
to
b4d0280
Compare
33413f4
to
57dacd7
Compare
The base branch was changed.
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.
In general, all the hooks contain repetitive code, basically doing the same things. Any idea on better refactoring / reduced code repeats?
Also, per my inline comment, we should check from AlchemyAccountContext which state the user/account is in, and throw informative error messages instead of just throwing null exceptions or other generic error messages
} = useMutation( | ||
{ | ||
mutationFn: async (params: UseAddPasskeyParams) => { | ||
return signer!.addPasskey(params ?? undefined); |
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.
for all out hooks, we should check from AlchemyAccountContext which state the user/account is in, and throw informative error messages instead of just throwing null exceptions or other generic error messages
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.
the useSigner hook will throw an error if there is no clientStore we can get the signer from (and thus the user, account, etc.).
let's chat more with Moldy when he's back. he actually advised here that i move this approach.
re: this, lemme refactor after getting this hooks stack. agree there's probably some factory method i can create and pass a mutation function unique to the hook for. |
57dacd7
to
fb55de7
Compare
@avasisht23 if we are fast-following reviewed comments/TODOs, would be great to attach asana links to the tasks for each items to be followed. Otherwise those items would be hard to track. |
Pull Request Checklist
yarn test
)site
folder, and guidelines for updating/adding docs can be found in the contribution guide)feat!: breaking change
)yarn lint:check
) and fix any issues? (yarn lint:write
)PR-Codex overview
This PR adds a new
useLogout
hook to facilitate user logout functionality in the Alchemy package.Detailed summary
useLogout
hook inalchemy
package for user logoutuseAddPasskey
to include mutation handlingComponentWithLogout
insite/snippets/react/useLogout.tsx
site/react/useLogout.md