LearnNewsExamplesServices
Frontmatter
id8549
titleFix duplicate listener on TimelineCanvas during navigation
stateClosed
labels
bugai
assigneestobiu
createdAtJan 11, 2026, 4:25 PM
updatedAtJan 11, 2026, 4:32 PM
githubUrlhttps://github.com/neomjs/neo/issues/8549
authortobiu
commentsCount1
parentIssue8398
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 11, 2026, 4:32 PM

Fix duplicate listener on TimelineCanvas during navigation

Closed v11.20.0 bugai
tobiu
tobiu commented on Jan 11, 2026, 4:25 PM

When navigating between the Tickets and Release views in the Portal app, TimelineCanvas accumulates duplicate load event listeners on the ContentSections store.

This happens because Canvas.mjs toggles offscreenRegistered to false on unmount and true on mount. TimelineCanvas adds a listener when offscreenRegistered becomes true, but fails to remove it when it becomes false.

Fix:

  • Update apps/portal/view/news/tickets/TimelineCanvas.mjs to unsubscribe from the store when offscreenRegistered is set to false.
  • Reset isCanvasReady to false on cleanup.
  • Ensure robust cleanup to prevent memory leaks and console errors.
tobiu added the bug label on Jan 11, 2026, 4:25 PM
tobiu added the ai label on Jan 11, 2026, 4:25 PM
tobiu referenced in commit de9ecfb - "fix: Prevent duplicate TimelineCanvas listeners by moving attachment to onConstructed (#8549)" on Jan 11, 2026, 4:29 PM
tobiu assigned to @tobiu on Jan 11, 2026, 4:30 PM
tobiu
tobiu Jan 11, 2026, 4:30 PM

Input from Gemini 3 Pro:

✦ I have moved the store listener attachment from afterSetOffscreenRegistered to onConstructed.

Why:

  • afterSetOffscreenRegistered toggles between true/false when the component is mounted/unmounted (e.g., navigating between views).
  • Since the component instance is cached and reused, afterSetOffscreenRegistered fired repeatedly, adding a new listener each time without cleanup.
  • onConstructed fires only once per instance. By attaching the listener there, we ensure it is added exactly once for the lifetime of the component.
  • afterSetOffscreenRegistered now correctly handles the "ready" state toggling (isCanvasReady) and manual data synchronization on re-mount, without managing listeners.

This resolves the "Duplicate event handler attached" error while preserving correct behavior.

tobiu added parent issue #8398 on Jan 11, 2026, 4:32 PM
tobiu closed this issue on Jan 11, 2026, 4:32 PM