Skip to content

Commit 09af548

Browse files
committed
fix: Ensure loading state is correctly reset and useEffect re-runs on component remount after cleanup.
1 parent 1cd4b88 commit 09af548

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

src/GitNativeFederation.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ const GitNativeFederation = ({ variant = 'panel', onRequestClose }) => {
365365
await refreshState({ silent: true });
366366
} finally {
367367
setInitializing(false);
368+
setLoading(false); // FIX: Ensure loading ends after initial silent load
368369
}
369370
})();
370371

src/components/GitFederationBootstrap.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ export default function GitFederationBootstrap({ enableEagerInit = false }) {
218218

219219
// Cleanup
220220
return () => {
221+
// CRITICAL: Reset initRef so effect runs again on remount (fixes React StrictMode)
222+
initRef.current = false;
221223
if (commandListenerRef.current) {
222224
window.removeEventListener('universe-backend-command', commandListenerRef.current);
223225
}

0 commit comments

Comments
 (0)