LearnNewsExamplesServices
Frontmatter
id8812
titleInvestigate and Implement Generic Fix for Phantom Mounts in Nested TabContainers
stateClosed
labels
enhancementaiarchitecture
assigneestobiu
createdAtJan 19, 2026, 3:24 PM
updatedAtJan 19, 2026, 3:36 PM
githubUrlhttps://github.com/neomjs/neo/issues/8812
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 19, 2026, 3:36 PM

Investigate and Implement Generic Fix for Phantom Mounts in Nested TabContainers

Closed v11.23.0 enhancementaiarchitecture
tobiu
tobiu commented on Jan 19, 2026, 3:24 PM

Objective: Investigate and implement a generic, framework-level pattern to synchronize TabContainer state restoration with the Router to prevent "Phantom Mounts" of previously active tabs.

Context: Currently, when a user navigates away from a nested TabContainer (inside a Card layout) and then returns, the TabContainer restores its previous activeIndex before the Router has a chance to apply the new route state. This causes a brief "phantom mount" of the old tab, leading to unnecessary work and potential race conditions (e.g., with TimelineCanvas).

Current Workaround: In apps/portal/view/news/TabContainer.mjs, afterSetMounted is used to reset activeIndex to null on unmount.

Goals:

  1. Analyze the interaction between Neo.tab.Container, Neo.layout.Card, and Neo.router.
  2. Identify a generic way to defer state restoration or synchronize it with the Router.
  3. Implement the solution in the framework or provide a standard pattern.
  4. Remove the workaround from the Portal app.

Key Files:

  • apps/portal/view/news/TabContainer.mjs
  • src/tab/Container.mjs
  • src/layout/Card.mjs
  • apps/portal/view/news/TabContainerController.mjs
tobiu added the enhancement label on Jan 19, 2026, 3:24 PM
tobiu added the ai label on Jan 19, 2026, 3:24 PM
tobiu added the architecture label on Jan 19, 2026, 3:24 PM
tobiu referenced in commit cc7def1 - "feat: Add resetActiveIndexOnUnmount config to Neo.tab.Container (#8812) on Jan 19, 2026, 3:35 PM
tobiu
tobiu Jan 19, 2026, 3:36 PM

Input from Gemini 3 Pro:

✦ I have implemented the generic fix for the "Phantom Mount" issue.

Changes:

  1. src/tab/Container.mjs: Added a new config resetActiveIndexOnUnmount (default: false). When set to true, the activeIndex is automatically reset to null when the component unmounts (afterSetMounted hook).
  2. apps/portal/view/news/TabContainer.mjs: Removed the manual afterSetMounted workaround and enabled resetActiveIndexOnUnmount: true.

This provides a clean, declarative way for router-driven TabContainers to ensure they start in a clean state upon remounting, preventing the display of stale tabs before the router applies the new state.

tobiu assigned to @tobiu on Jan 19, 2026, 3:36 PM
tobiu closed this issue on Jan 19, 2026, 3:36 PM
tobiu cross-referenced by #8813 on Jan 19, 2026, 3:49 PM