Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions apps/sim/app/api/workflows/[id]/variables/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,18 +153,12 @@ export const GET = withRouteHandler(
}
}

// Add cache headers to prevent frequent reloading
const variableHash = JSON.stringify(variables).length
const headers = new Headers({
'Cache-Control': 'max-age=30, stale-while-revalidate=300', // Cache for 30 seconds, stale for 5 min
ETag: `"variables-${workflowId}-${variableHash}"`,
})

return NextResponse.json(
{ data: variables },
{
status: 200,
headers,
// Cookie-authenticated variables must not be stored or reused by HTTP caches.
headers: { 'Cache-Control': 'private, no-store' },
Comment thread
waleedlatif1 marked this conversation as resolved.
}
)
} catch (error) {
Expand Down
Loading