Frontmatter
| id | 8560 |
| title | Replace hardcoded timeout in MainContainerController with deterministic wait |
| state | Closed |
| labels | airefactoringperformance |
| assignees | tobiu |
| createdAt | Jan 11, 2026, 11:45 PM |
| updatedAt | Jan 11, 2026, 11:55 PM |
| githubUrl | https://github.com/neomjs/neo/issues/8560 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | 8398 |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jan 11, 2026, 11:55 PM |
Replace hardcoded timeout in MainContainerController with deterministic wait
tobiu assigned to @tobiu on Jan 11, 2026, 11:54 PM

tobiu
Jan 11, 2026, 11:54 PM
Input from Gemini 3 Pro:
✦ I have replaced the hardcoded
timeout(100)inMainContainerController.mjswith a robustwaitForDomRectcheck.Changes:
- Replaced
await me.timeout(100)withawait tree.waitForDomRect({id, attempts: 20, delay: 20}).- This ensures the code waits for the tree item to be truly rendered, visible, and laid out (expanded) before attempting to scroll to it.
- This addresses the flakiness of fixed timeouts while ensuring scrolling only happens when the target is ready.
I also removed the arbitrary 20ms delay in
TreeList.afterSetCurrentPageRecordas discussed, assuming the reactive update cycle should handle selection state correctly.
tobiu added parent issue #8398 on Jan 11, 2026, 11:54 PM
tobiu closed this issue on Jan 11, 2026, 11:55 PM
tobiu cross-referenced by #8561 on Jan 11, 2026, 11:56 PM
In
apps/portal/view/news/tickets/MainContainerController.mjs,onRouteItemuses a hardcoded delay:if (!oldValue?.hashString?.startsWith('/news/tickets')) { await me.timeout(100); tree.scrollToItem(itemId) }This delay is intended to wait for the tree to expand and render before scrolling. However, 100ms is arbitrary and can be flaky or wasteful.
Proposed Solution: Replace
await me.timeout(100)with a deterministic wait, likelyawait tree.promiseUpdate(), which ensures that the VDOM updates (triggered bytree.expandParents(itemId)) have been processed and applied to the DOM.We need to verify if
promiseUpdate()is sufficient forscrollToItemto work (which relies ondocument.getElementById).