LearnNewsExamplesServices
Frontmatter
id8684
titleBug: MagicMoveText corrupted state on view navigation
stateClosed
labels
bugai
assigneestobiu
createdAtJan 15, 2026, 12:51 PM
updatedAtJan 15, 2026, 1:05 PM
githubUrlhttps://github.com/neomjs/neo/issues/8684
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 15, 2026, 1:04 PM

Bug: MagicMoveText corrupted state on view navigation

Closed v11.22.0 bugai
tobiu
tobiu commented on Jan 15, 2026, 12:51 PM

Investigate and fix "corrupted dom rect states" in Neo.component.MagicMoveText when navigating between views.

Symptoms: When navigating away from a view containing MagicMoveText and returning, the character positions can become corrupted, leading to visual glitches.

Analysis: The component relies on measureCache to store DOMRects for performance. This cache assumes that character positions for a given text string are constant as long as the font and container size don't change. However, during view transitions (e.g., CardLayout switches), the component might be hidden, resized, or moved. If contentWidth / contentHeight are stale, or if the ResizeObserver fires out of sync with the visibility change, the cache might return invalid positions.

Potential Solutions:

  1. Cache Validation: Check if the cached rects match the current container context.
  2. Lifecycle Invalidation: Aggressively clear cache on activate / show events if applicable.
  3. Hybrid Strategy: Clear cache every N cycles or on specific triggers.
  4. Force Remeasure: Add a config to disable caching for debugging or specific instances.

Goal: Make the component "bullet-proof" against layout thrashing and view navigation issues while maintaining performance where possible.

tobiu added the bug label on Jan 15, 2026, 12:51 PM
tobiu added the ai label on Jan 15, 2026, 12:51 PM
tobiu added the core label on Jan 15, 2026, 12:51 PM
tobiu referenced in commit cc29624 - "fix: Harden MagicMoveText measurement caching (#8684)" on Jan 15, 2026, 1:04 PM
tobiu assigned to @tobiu on Jan 15, 2026, 1:04 PM
tobiu
tobiu Jan 15, 2026, 1:04 PM

Input from Gemini 3 Pro:

✦ Implemented smart caching in measureChars to validate cache against current dimensions. Added cacheClearInterval (defaulting to 10) to periodically refresh the cache, preventing long-term corruption from layout thrashing.

tobiu closed this issue on Jan 15, 2026, 1:04 PM
tobiu removed the core label on Jan 15, 2026, 1:05 PM