Skip to content

Commit

Permalink
Fix token not refreshing on React SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
escorponox committed Sep 10, 2024
1 parent 620705b commit d42b0b3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 4 additions & 0 deletions packages/sdk-react/CHANGES.md
Original file line number Diff line number Diff line change
@@ -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).
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-react/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -7,12 +7,8 @@ export function useTokenRefresh(core: SDKCore, shouldAutoRefresh: boolean) {
[core],
);

const autoRefreshTimeout = useRef<NodeJS.Timeout | undefined>();
const initAutoRefresh = useCallback(() => {
if (autoRefreshTimeout.current) {
return;
}
autoRefreshTimeout.current = core.initAutoRefresh();
core.initAutoRefresh();
}, [core]);

useEffect(() => {
Expand Down

0 comments on commit d42b0b3

Please sign in to comment.