Add loading spinner and debug logs for file fetch
Some checks are pending
CI / Engine — lint / typecheck / test (push) Waiting to run
CI / API — lint / typecheck / test (push) Waiting to run
CI / Web — typecheck / lint / build (push) Waiting to run

This commit is contained in:
Manohar Gupta 2026-05-23 23:47:46 +05:30
parent dda17fa6c3
commit d2c2e2fe63

View file

@ -90,12 +90,19 @@ export function ProfileViewer() {
: "http://localhost:8000"; : "http://localhost:8000";
async function fetchAndDisplayFile(path: string, name: string) { async function fetchAndDisplayFile(path: string, name: string) {
console.log("fetchAndDisplayFile called:", path, name);
setIsLoadingFile(true); setIsLoadingFile(true);
try { try {
const res = await fetch(`${API_BASE}${path}`); const url = `${API_BASE}${path}`;
console.log("Fetching:", url);
const res = await fetch(url);
console.log("Response status:", res.status);
const text = await res.text(); const text = await res.text();
console.log("Response length:", text.length);
const lines = text.trim().split("\n"); const lines = text.trim().split("\n");
console.log("Lines count:", lines.length);
const data = lines.slice(1).map((line) => line.split(",")); const data = lines.slice(1).map((line) => line.split(","));
console.log("Data rows:", data.length);
setSelectedFile({ name, path, data }); setSelectedFile({ name, path, data });
} catch (err) { } catch (err) {
console.error("Failed to fetch file:", err); console.error("Failed to fetch file:", err);
@ -266,7 +273,14 @@ export function ProfileViewer() {
</div> </div>
<div className="flex-1 overflow-y-auto p-4"> <div className="flex-1 overflow-y-auto p-4">
{selectedFile ? ( {isLoadingFile ? (
<div className="flex items-center justify-center py-20">
<div className="text-center">
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto mb-4"></div>
<p className="text-muted-foreground">Loading file data...</p>
</div>
</div>
) : selectedFile ? (
<div className="mb-6 border rounded-lg overflow-hidden"> <div className="mb-6 border rounded-lg overflow-hidden">
<div className="flex items-center justify-between p-4 bg-blue-50 border-b"> <div className="flex items-center justify-between p-4 bg-blue-50 border-b">
<div className="flex items-center gap-3"> <div className="flex items-center gap-3">