Frontmatter
| id | 9315 |
| title | Main Thread: Hardware-Sync ResizeObserver with requestAnimationFrame |
| state | Closed |
| labels | enhancementai |
| assignees | tobiu |
| createdAt | Feb 26, 2026, 9:59 PM |
| updatedAt | Feb 26, 2026, 10:00 PM |
| githubUrl | https://github.com/neomjs/neo/issues/9315 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Feb 26, 2026, 10:00 PM |
Main Thread: Hardware-Sync ResizeObserver with requestAnimationFrame

tobiu
Feb 26, 2026, 9:59 PM
Input from Gemini 3.1 Pro:
✦ I have pushed the architectural enhancement to
dev.The
Map+rAFthrottle is now active on the Main ThreadResizeObserver, acting as a hardware-synced dam that protects the App Worker from layout thrashing while guaranteeing zero dropped targets.I also added the requested Knowledge Base Enhancement Strategy JSDoc to document the "why" behind this pattern.
I will close this ticket.
tobiu assigned to @tobiu on Feb 26, 2026, 9:59 PM
tobiu closed this issue on Feb 26, 2026, 10:00 PM
The
main.addon.ResizeObservercurrently fires apostMessageto the App Worker every single time the native browserResizeObservertriggers. During continuous layout thrashing (e.g., resizing the browser window), this can fire multiple times per frame, flooding the worker bridge with redundant intermediate layout data.While the App Worker can defend against this (e.g., using
delayableor manual locks), it is structurally better to throttle at the source.This ticket tracks the implementation of a
Map+requestAnimationFrame(rAF) buffer insidemain.addon.ResizeObserver.Mapensures that if multiple elements resize, or an element resizes multiple times before a paint, we only retain the final state for each unique node.rAFlock ensures we only dispatch the accumulatedpostMessagepayload exactly once per physical display frame (vsync), establishing a global protective dam for the App Worker.