Fix timelapse auto-download and browser tab crash on print completion

1. Timelapse auto-download rewrite (main.py)
   - New retry mechanism with short delays (5s, 10s, 20s)
   - Grabs most recent file directly without mtime comparison
   - Works with printers that have wrong clock (LAN-only mode)
   - Checks multiple paths: /timelapse, /timelapse/video, /record, /recording

2. Browser tab crash fix (PrintersPage.tsx)
   - Throttled query cache subscription using requestAnimationFrame
   - Prevents rapid re-render cascade on print completion events

3. WebSocket optimization (main.py)
   - Removed large raw_data field from print_complete message
   - Only sends necessary fields: status, filename, subtask_name, timelapse_was_active

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
maziggy
2025-12-14 08:46:38 +01:00
co-authored by Claude Opus 4.5
parent 4b8e6ca797
commit ca2bd6bf57
4 changed files with 139 additions and 108 deletions
+9 -1
View File
@@ -453,10 +453,18 @@ function StatusSummaryBar({ printers }: { printers: Printer[] | undefined }) {
}, [printers, queryClient]);
// Subscribe to query cache changes to re-render when status updates
// Throttled to prevent rapid re-renders from causing tab crashes
const [, setTick] = useState(0);
useEffect(() => {
let pending = false;
const unsubscribe = queryClient.getQueryCache().subscribe(() => {
setTick(t => t + 1);
if (!pending) {
pending = true;
requestAnimationFrame(() => {
setTick(t => t + 1);
pending = false;
});
}
});
return () => unsubscribe();
}, [queryClient]);