Skip to content

Commit b5d4d5e

Browse files
committed
refactor(expo): move pk change reset to useEffect
Move publishable key hot-swap ref reset into a useEffect with pk in the dependency array. Removes the prevPkRef manual comparison.
1 parent 21933a6 commit b5d4d5e

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

packages/expo/src/provider/ClerkProvider.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,12 @@ export function ClerkProvider<TUi extends Ui = Ui>(props: ClerkProviderProps<TUi
6868
const pendingNativeSessionRef = useRef<string | null>(null);
6969
const initStartedRef = useRef(false);
7070
const sessionSyncedRef = useRef(false);
71-
const prevPkRef = useRef(pk);
72-
7371
// Reset refs when publishable key changes (hot-swap support)
74-
if (prevPkRef.current !== pk) {
75-
prevPkRef.current = pk;
72+
useEffect(() => {
7673
pendingNativeSessionRef.current = null;
7774
initStartedRef.current = false;
7875
sessionSyncedRef.current = false;
79-
}
76+
}, [pk]);
8077

8178
// Get the Clerk instance for syncing
8279
const clerkInstance = isNative()

0 commit comments

Comments
 (0)