prevent unnecessary reloads in useUserPersistence hook

This commit is contained in:
Josh Hawkins 2026-03-06 22:43:53 -06:00
parent c2e667c0dd
commit 22056c3fc1

View File

@ -116,6 +116,11 @@ export function useUserPersistence<S>(
return;
}
// Skip reload if we're already loaded for this key
if (loadedKeyRef.current === namespacedKey) {
return;
}
// Reset state when key changes - this prevents stale writes
loadedKeyRef.current = null;
migrationAttemptedRef.current = false;