@umituz/react-native-auth 4.3.42 → 4.3.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-auth",
3
- "version": "4.3.42",
3
+ "version": "4.3.43",
4
4
  "description": "Authentication service for React Native apps - Secure, type-safe, and production-ready. Provider-agnostic design with dependency injection, configurable validation, and comprehensive error handling.",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -28,6 +28,10 @@ export function useAuthTransitions(
28
28
  const prevIsAnonymousRef = useRef(state.isAnonymous);
29
29
  const prevIsVisibleRef = useRef(state.isVisible);
30
30
  const cleanupRef = useRef<(() => void) | null>(null);
31
+ const onTransitionRef = useRef(onTransition);
32
+
33
+ // Keep ref in sync without adding to effect deps
34
+ onTransitionRef.current = onTransition;
31
35
 
32
36
  useEffect(() => {
33
37
  const justAuthenticated = !prevIsAuthenticatedRef.current && state.isAuthenticated;
@@ -45,7 +49,7 @@ export function useAuthTransitions(
45
49
  // Call previous cleanup before running new transition
46
50
  cleanupRef.current?.();
47
51
 
48
- const cleanup = onTransition?.(result);
52
+ const cleanup = onTransitionRef.current?.(result);
49
53
  cleanupRef.current = (typeof cleanup === 'function' ? cleanup : null);
50
54
 
51
55
  prevIsAuthenticatedRef.current = state.isAuthenticated;
@@ -57,7 +61,7 @@ export function useAuthTransitions(
57
61
  cleanupRef.current?.();
58
62
  cleanupRef.current = null;
59
63
  };
60
- }, [state.isAuthenticated, state.isVisible, state.isAnonymous, onTransition]);
64
+ }, [state.isAuthenticated, state.isVisible, state.isAnonymous]);
61
65
  }
62
66
 
63
67
  /**