diff --git a/packages/auth-kit/CHANGELOG.md b/packages/auth-kit/CHANGELOG.md index 531dcb1..36b60fa 100644 --- a/packages/auth-kit/CHANGELOG.md +++ b/packages/auth-kit/CHANGELOG.md @@ -1,5 +1,11 @@ # @farcaster/auth-kit +## 0.2.1 + +### Patch Changes + +- 1bee0fb: fix: memoize signIn/signOut in useSignIn + ## 0.2.0 ### Minor Changes diff --git a/packages/auth-kit/package.json b/packages/auth-kit/package.json index 79347de..f252c6a 100644 --- a/packages/auth-kit/package.json +++ b/packages/auth-kit/package.json @@ -1,6 +1,6 @@ { "name": "@farcaster/auth-kit", - "version": "0.2.0", + "version": "0.2.1", "type": "module", "main": "./dist/auth-kit.js", "types": "./dist/auth-kit.d.ts", diff --git a/packages/auth-kit/src/hooks/useSignIn.ts b/packages/auth-kit/src/hooks/useSignIn.ts index 82a8278..385e345 100644 --- a/packages/auth-kit/src/hooks/useSignIn.ts +++ b/packages/auth-kit/src/hooks/useSignIn.ts @@ -1,5 +1,5 @@ import { AuthClientError, StatusAPIResponse } from "@farcaster/auth-client"; -import { useEffect } from "react"; +import { useCallback, useEffect } from "react"; import useAppClient from "./useAppClient"; import useCreateChannel, { UseCreateChannelArgs } from "./useCreateChannel"; @@ -74,14 +74,14 @@ export function useSignIn(args: UseSignInArgs) { const isError = isCreateChannelError || isWatchStatusError || isVerifyError; const error = createChannelError || watchStatusError || verifyError; - const signIn = () => { + const signIn = useCallback(() => { watch(); - }; + }, [watch]); - const signOut = () => { + const signOut = useCallback(() => { onSignOut(); reset(); - }; + }, [onSignOut, reset]); useEffect(() => { if (isSuccess && statusData && validSignature) {