fix(editor): reset compilation console filter on each new compile
The console auto-switched to the 'errors' filter when a compile produced an error, but never reset it. After one failing compile, every later SUCCESSFUL compile (info/success lines only) was hidden by the sticky filter — the console looked empty while the simulation started, 'unless there was an error'. Now reset the filter to 'all' whenever the log shrinks (a fresh compile cleared it) so the next batch is always visible. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
5bbf2427ec
commit
6c35a6ea7f
|
|
@ -32,8 +32,21 @@ export const CompilationConsole: React.FC<CompilationConsoleProps> = ({
|
|||
}
|
||||
}, [logs, autoscroll]);
|
||||
|
||||
// Auto-switch to "Errors" filter when a new batch of logs arrives with errors
|
||||
// Auto-switch to "Errors" filter when a new batch of logs arrives with
|
||||
// errors — but reset to "all" the moment a fresh compile clears/shrinks
|
||||
// the log. Without that reset the 'errors' filter was sticky: after one
|
||||
// failing compile, every later SUCCESSFUL compile (info/success lines
|
||||
// only) was filtered out and the console looked empty while the sim
|
||||
// started. (Reported: "output doesn't refresh after the first compile,
|
||||
// unless there's an error".)
|
||||
useEffect(() => {
|
||||
if (logs.length < prevLogsLenRef.current) {
|
||||
// A clear() or reset shrank the list — treat it as a brand-new
|
||||
// compile and drop any sticky filter so the next batch is visible.
|
||||
prevLogsLenRef.current = logs.length;
|
||||
setFilter('all');
|
||||
return;
|
||||
}
|
||||
if (logs.length === prevLogsLenRef.current) return;
|
||||
const newLogs = logs.slice(prevLogsLenRef.current);
|
||||
prevLogsLenRef.current = logs.length;
|
||||
|
|
|
|||
Loading…
Reference in New Issue