Skip to content

Commit ee8e8f8

Browse files
committed
feat: Increase GitNativeFederation refresh timeout, add silent initial load, and refresh SaveStatusDisplay on universe creation.
1 parent 6e55b32 commit ee8e8f8

2 files changed

Lines changed: 17 additions & 40 deletions

File tree

src/GitNativeFederation.jsx

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ function buttonStyle(variant = 'outline') {
214214
const GitNativeFederation = ({ variant = 'panel', onRequestClose }) => {
215215
const [serviceState, setServiceState] = useState(blankState);
216216
const [loading, setLoading] = useState(false);
217-
const [initializing, setInitializing] = useState(true);
217+
const [initializing, setInitializing] = useState(false); // Start false - don't block UI on load
218218
const [syncStatus, setSyncStatus] = useState(null);
219219
const [error, setError] = useState(null);
220220
const [isConnecting, setIsConnecting] = useState(false);
@@ -288,7 +288,7 @@ const GitNativeFederation = ({ variant = 'panel', onRequestClose }) => {
288288
}, []);
289289

290290
const refreshState = useCallback(async (options = {}) => {
291-
const { silent = false, timeoutMs = 2000 } = options; // Reduced from 8000ms to improve responsiveness
291+
const { silent = false, timeoutMs = 5000 } = options; // 5s timeout for better reliability
292292
const timerApi = typeof window !== 'undefined' ? window : globalThis;
293293
let timeoutId = null;
294294
let didTimeout = false;
@@ -361,7 +361,8 @@ const GitNativeFederation = ({ variant = 'panel', onRequestClose }) => {
361361
// Load state asynchronously and allow component to render immediately
362362
(async () => {
363363
try {
364-
await refreshState();
364+
// Use silent mode for initial load to avoid showing loading state
365+
await refreshState({ silent: true });
365366
} finally {
366367
setInitializing(false);
367368
}
@@ -4542,39 +4543,7 @@ const GitNativeFederation = ({ variant = 'panel', onRequestClose }) => {
45424543
</div>
45434544
</Modal>
45444545

4545-
{/* General loading overlay - centered spinner */}
4546-
{(initializing || loading) && !isConnecting && (
4547-
<>
4548-
<style>
4549-
{`
4550-
@keyframes spin {
4551-
0% { transform: rotate(0deg); }
4552-
100% { transform: rotate(360deg); }
4553-
}
4554-
`}
4555-
</style>
4556-
<div
4557-
style={{
4558-
position: 'fixed',
4559-
top: 0,
4560-
left: 0,
4561-
right: 0,
4562-
bottom: 0,
4563-
backgroundColor: 'rgba(0,0,0,0.3)',
4564-
display: 'flex',
4565-
alignItems: 'center',
4566-
justifyContent: 'center',
4567-
zIndex: 999
4568-
}}
4569-
>
4570-
<Loader2
4571-
size={48}
4572-
color="#8B0000"
4573-
style={{ animation: 'spin 1s linear infinite' }}
4574-
/>
4575-
</div>
4576-
</>
4577-
)}
4546+
{/* Loading overlay removed - content renders immediately while data loads in background */}
45784547

45794548
{/* Connecting screen - inline, scrollable, PieMenu-style */}
45804549
{isConnecting && (

src/SaveStatusDisplay.jsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const SaveStatusDisplay = () => {
5252
const pendingCommits = Number(engine?.pendingCommits || 0);
5353
const isCommitting = engine?.isRunning || false;
5454
const hasUnsavedChanges = engine?.hasChanges || false;
55-
55+
5656
// Check SaveCoordinator for immediate dirty flag (includes drag operations)
5757
const coordinatorHasUnsaved = saveCoordinator.hasUnsavedChanges();
5858
const coordinatorIsSaving = saveCoordinator.isSaving;
@@ -98,9 +98,17 @@ const SaveStatusDisplay = () => {
9898
// Initial poll
9999
poll();
100100

101+
// Listen for universe creation events to refresh immediately
102+
const handleUniverseCreated = () => {
103+
console.log('[SaveStatusDisplay] Universe created, refreshing status...');
104+
poll();
105+
};
106+
window.addEventListener('redstring:universe-created', handleUniverseCreated);
107+
101108
return () => {
102109
cancelled = true;
103110
if (pollInterval) clearTimeout(pollInterval);
111+
window.removeEventListener('redstring:universe-created', handleUniverseCreated);
104112
};
105113
}, []);
106114

@@ -135,21 +143,21 @@ const SaveStatusDisplay = () => {
135143
if (isCTA) {
136144
try {
137145
window.dispatchEvent(new CustomEvent('redstring:open-federation'));
138-
} catch {}
146+
} catch { }
139147
}
140148
}}
141149
onMouseEnter={(e) => {
142150
if (!isCTA) return;
143151
try {
144152
e.currentTarget.style.transform = 'scale(1.06)';
145153
e.currentTarget.style.transition = 'transform 120ms ease';
146-
} catch {}
154+
} catch { }
147155
}}
148156
onMouseLeave={(e) => {
149157
if (!isCTA) return;
150158
try {
151159
e.currentTarget.style.transform = 'scale(1)';
152-
} catch {}
160+
} catch { }
153161
}}
154162
>
155163
{statusText}

0 commit comments

Comments
 (0)