small table rename bug, files updates not persisting

This commit is contained in:
waleed
2026-03-09 18:38:40 -07:00
parent 8abe717b85
commit b7a6fe574c
4 changed files with 9 additions and 3 deletions

View File

@@ -111,6 +111,7 @@ async function handleLocalFile(filename: string, userId: string): Promise<NextRe
buffer: fileBuffer,
contentType,
filename,
cacheControl: contextParam === 'workspace' ? 'private, no-cache, must-revalidate' : undefined,
})
} catch (error) {
logger.error('Error reading local file:', error)
@@ -172,6 +173,7 @@ async function handleCloudProxy(
buffer: fileBuffer,
contentType,
filename: originalFilename,
cacheControl: context === 'workspace' ? 'private, no-cache, must-revalidate' : undefined,
})
} catch (error) {
logger.error('Error downloading from cloud storage:', error)

View File

@@ -21,6 +21,7 @@ export interface FileResponse {
buffer: Buffer
contentType: string
filename: string
cacheControl?: string
}
export class FileNotFoundError extends Error {
@@ -256,7 +257,7 @@ export function createFileResponse(file: FileResponse): NextResponse {
headers: {
'Content-Type': contentType,
'Content-Disposition': `${disposition}; ${encodeFilenameForHeader(file.filename)}`,
'Cache-Control': 'public, max-age=31536000',
'Cache-Control': file.cacheControl || 'public, max-age=31536000',
'X-Content-Type-Options': 'nosniff',
'Content-Security-Policy': "default-src 'none'; style-src 'unsafe-inline'; sandbox;",
},

View File

@@ -540,6 +540,9 @@ export function Table({
if (!el) return
const handleKeyDown = (e: KeyboardEvent) => {
const tag = (e.target as HTMLElement).tagName
if (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT') return
const anchor = selectionAnchorRef.current
if (!anchor || editingCellRef.current || editingEmptyCellRef.current) return

View File

@@ -62,8 +62,8 @@ export function useWorkspaceFiles(workspaceId: string) {
* Fetch file content as text via the serve URL
*/
async function fetchWorkspaceFileContent(key: string, signal?: AbortSignal): Promise<string> {
const serveUrl = `/api/files/serve/${encodeURIComponent(key)}?context=workspace`
const response = await fetch(serveUrl, { signal })
const serveUrl = `/api/files/serve/${encodeURIComponent(key)}?context=workspace&t=${Date.now()}`
const response = await fetch(serveUrl, { signal, cache: 'no-store' })
if (!response.ok) {
throw new Error('Failed to fetch file content')