diff --git a/packages/sdk-react/CHANGES.md b/packages/sdk-react/CHANGES.md index b713af8..a63b8e2 100644 --- a/packages/sdk-react/CHANGES.md +++ b/packages/sdk-react/CHANGES.md @@ -1,5 +1,9 @@ fusionauth-react-sdk Changes +Changes in 2.4.2 + +- Fix a bug where the token is not refreshed in React-SDK. + Changes in 2.4.1 - Fix the bug where the user is logged out on a successful token refresh. Resolved in PR [161](https://github.com/FusionAuth/fusionauth-javascript-sdk/pull/161). diff --git a/packages/sdk-react/package.json b/packages/sdk-react/package.json index 0e981d9..473ef67 100644 --- a/packages/sdk-react/package.json +++ b/packages/sdk-react/package.json @@ -1,6 +1,6 @@ { "name": "@fusionauth/react-sdk", - "version": "2.4.1", + "version": "2.4.2", "private": false, "description": "FusionAuth solves the problem of building essential security without adding risk or distracting from your primary application", "type": "module", diff --git a/packages/sdk-react/src/components/providers/hooks/useTokenRefresh.ts b/packages/sdk-react/src/components/providers/hooks/useTokenRefresh.ts index a33b620..ae7f8b0 100644 --- a/packages/sdk-react/src/components/providers/hooks/useTokenRefresh.ts +++ b/packages/sdk-react/src/components/providers/hooks/useTokenRefresh.ts @@ -1,4 +1,4 @@ -import { useEffect, useCallback, useRef } from 'react'; +import { useEffect, useCallback } from 'react'; import { SDKCore } from '@fusionauth-sdk/core'; export function useTokenRefresh(core: SDKCore, shouldAutoRefresh: boolean) { @@ -7,12 +7,8 @@ export function useTokenRefresh(core: SDKCore, shouldAutoRefresh: boolean) { [core], ); - const autoRefreshTimeout = useRef(); const initAutoRefresh = useCallback(() => { - if (autoRefreshTimeout.current) { - return; - } - autoRefreshTimeout.current = core.initAutoRefresh(); + core.initAutoRefresh(); }, [core]); useEffect(() => {