tycono 0.1.96-beta.46 → 0.1.96-beta.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/tui/app.tsx +12 -0
- package/src/tui/hooks/useApi.ts +5 -2
package/package.json
CHANGED
package/src/tui/app.tsx
CHANGED
|
@@ -192,6 +192,7 @@ export const App: React.FC = () => {
|
|
|
192
192
|
// View state: loading -> setup (no company) -> dashboard
|
|
193
193
|
const [view, setView] = useState<View>('loading');
|
|
194
194
|
|
|
195
|
+
// Loading → setup/dashboard transition
|
|
195
196
|
React.useEffect(() => {
|
|
196
197
|
if (!api.loaded) return;
|
|
197
198
|
if (view === 'loading') {
|
|
@@ -199,6 +200,17 @@ export const App: React.FC = () => {
|
|
|
199
200
|
}
|
|
200
201
|
}, [api.loaded, api.company, view]);
|
|
201
202
|
|
|
203
|
+
// Fallback: if loading for more than 8 seconds, force to setup
|
|
204
|
+
React.useEffect(() => {
|
|
205
|
+
if (view !== 'loading') return;
|
|
206
|
+
const timer = setTimeout(() => {
|
|
207
|
+
if (view === 'loading') {
|
|
208
|
+
setView('setup');
|
|
209
|
+
}
|
|
210
|
+
}, 8000);
|
|
211
|
+
return () => clearTimeout(timer);
|
|
212
|
+
}, [view]);
|
|
213
|
+
|
|
202
214
|
const handleSetupComplete = useCallback(() => {
|
|
203
215
|
api.refresh();
|
|
204
216
|
setView('dashboard');
|
package/src/tui/hooks/useApi.ts
CHANGED
|
@@ -90,10 +90,13 @@ export function useApi(): ApiState {
|
|
|
90
90
|
|
|
91
91
|
setError(null);
|
|
92
92
|
setLoaded(true);
|
|
93
|
+
process.stderr.write(`[useApi] loaded=true company=${comp ? 'yes' : 'no'}\n`);
|
|
93
94
|
} catch (err) {
|
|
94
95
|
if (mountedRef.current) {
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
const msg = err instanceof Error ? err.message : 'API error';
|
|
97
|
+
setError(msg);
|
|
98
|
+
setLoaded(true);
|
|
99
|
+
process.stderr.write(`[useApi] loaded=true (error: ${msg})\n`);
|
|
97
100
|
}
|
|
98
101
|
}
|
|
99
102
|
}, []);
|