Improve session history loading resiliency (#3588)

This commit is contained in:
Zane
2025-07-23 13:04:12 -07:00
committed by GitHub
parent f55549eac9
commit 74140ad0f8
3 changed files with 105 additions and 29 deletions
@@ -47,6 +47,8 @@ export function SessionInsights() {
const data = await response.json();
setInsights(data);
// Clear any previous error when insights load successfully
setError(null);
} catch (error) {
console.error('Failed to load insights:', error);
setError(error instanceof Error ? error.message : 'Failed to load insights');
@@ -97,6 +99,8 @@ export function SessionInsights() {
totalTokens: 0,
};
}
// If we already have insights, just make sure loading is false
setIsLoading(false);
return currentInsights;
});
}, 10000); // 10 second timeout
@@ -111,7 +115,7 @@ export function SessionInsights() {
window.clearTimeout(loadingTimeout);
}
};
}, []); // Empty dependency array to run only once
}, []);
const handleSessionClick = async (sessionId: string) => {
try {