fix: try load files if there is no token

This commit is contained in:
Vukasin 2025-05-14 22:07:21 +02:00
parent fe05ccfb4f
commit 0b8fbdff61
1 changed files with 2 additions and 13 deletions

View File

@ -234,14 +234,6 @@ export function FileViewerModal({
loadingFileRef.current = file.path;
try {
// Check if we have a valid session token
if (!session?.access_token) {
throw new Error('Authentication token missing. Please refresh the page and login again.');
}
// Start timer for performance logging
const startTime = performance.now();
// For PDFs and Office documents, always use blob content type
const contentType = isPdfFile || isOfficeFile ? 'blob' : FileCache.getContentTypeFromPath(file.path);
@ -254,14 +246,11 @@ export function FileViewerModal({
{
contentType: contentType as 'text' | 'blob' | 'json',
force: isPdfFile, // Force refresh for PDFs to ensure we get a blob
token: session.access_token,
token: session?.access_token,
}
);
const loadTime = Math.round(performance.now() - startTime);
console.log(
`[FILE VIEWER] Received content for ${file.path} in ${loadTime}ms (${typeof content})`,
);
// Critical check: Ensure the file we just loaded is still the one selected
if (loadingFileRef.current !== file.path) {