fix(ui): disable aggressive polling on plan page to prevent layout thrashing

This commit is contained in:
2026-05-19 18:56:54 -07:00
parent d12e178b13
commit 273008e14b
2 changed files with 22 additions and 1 deletions

View File

@@ -0,0 +1,21 @@
const fs = require('fs');
const file = 'app/[workspace]/project/[projectId]/(home)/plan/page.tsx';
let code = fs.readFileSync(file, 'utf8');
// I injected SWR into the file earlier to stop the custom setInterval loop.
// However, the `fetcher` I injected doesn't use useCallback, and SWR's fallback/refresh
// logic might be triggering too aggressively because of how the subcomponents remount
// or because `refreshInterval` is fighting with `mutatePlan(newPlan, false)`.
// Let's remove the 15-second auto-polling. If the user edits something, we trigger a revalidation.
// If the AI edits something from the chat, we already have an SSE 'plan' event that
// streams the update directly to the UI! So we don't need SWR to poll AT ALL.
code = code.replace(
'{ refreshInterval: 15000, dedupingInterval: 5000 }',
'{ revalidateOnFocus: false, revalidateIfStale: false }'
);
fs.writeFileSync(file, code);
console.log("Disabled SWR polling on the Plan page");