mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
docs(ui): explain latest-ref pattern in shared OAuth hook
This commit is contained in:
parent
8e6a8b792f
commit
4ff04701d8
1 changed files with 3 additions and 0 deletions
|
|
@ -84,6 +84,9 @@ export const useMcpOAuthPkceFlow = ({
|
|||
const [error, setError] = useState<string | null>(null);
|
||||
const processingRef = useRef(false);
|
||||
|
||||
// Latest-ref pattern: reassigned every render so the memoized callbacks below
|
||||
// read the current buildReturnUrl/persistToken/onSuccess at call time without
|
||||
// listing them as deps (which would re-subscribe the on-mount resume effect).
|
||||
const callbacksRef = useRef({ buildReturnUrl, persistToken, onSuccess });
|
||||
callbacksRef.current = { buildReturnUrl, persistToken, onSuccess };
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue