mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-03 02:21:44 +00:00
fix(web): reset isMountedRef on mount (StrictMode double-invoke)
The mount effect set isMountedRef=false on cleanup but never back to true on re-mount, so under React StrictMode's mount->unmount->mount the ref stayed false for the component's lifetime — trackJob then always early-returned and the upload never advanced past 'starting' (caught by the folder-upload e2e). Set it true at the start of the effect. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7c4e5700ff
commit
1a5db7e39d
1 changed files with 3 additions and 0 deletions
|
|
@ -191,6 +191,9 @@ export const RepoAnalyzer = ({ variant, onComplete, onCancel }: RepoAnalyzerProp
|
|||
const isMountedRef = useRef(true);
|
||||
|
||||
useEffect(() => {
|
||||
// Set true on every mount (not just the initial ref value) so the guard is
|
||||
// correct under React StrictMode's mount→unmount→mount double-invoke.
|
||||
isMountedRef.current = true;
|
||||
return () => {
|
||||
isMountedRef.current = false;
|
||||
sseControllerRef.current?.abort();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue