LearnNewsExamplesServices
Frontmatter
id8808
titleCreate Portal.view.shared.Canvas for App Worker Canvas Components
stateClosed
labels
airefactoring
assigneestobiu
createdAtJan 19, 2026, 12:59 PM
updatedAtJan 19, 2026, 1:19 PM
githubUrlhttps://github.com/neomjs/neo/issues/8808
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 19, 2026, 1:19 PM

Create Portal.view.shared.Canvas for App Worker Canvas Components

Closed v11.23.0 airefactoring
tobiu
tobiu commented on Jan 19, 2026, 12:59 PM

Refactor the four App Worker canvas components to share a common base class Portal.view.shared.Canvas.

Location: apps/portal/view/shared/Canvas.mjs

Architecture: The base class will be generic and configured via strings to decouple it from specific worker implementations:

  • rendererClassName: (String) e.g., 'Portal.canvas.HomeCanvas'. Resolved via Neo.ns().
  • importMethodName: (String) e.g., 'importHomeCanvas'. Resolved on Portal.canvas.Helper.
  • getRenderer(): Helper method to resolve the singleton instance from rendererClassName.

Scope:

  1. Create apps/portal/view/shared/Canvas.mjs
  2. Refactor Portal.view.home.parts.hero.Canvas
  3. Refactor Portal.view.services.Canvas
  4. Refactor Portal.view.HeaderCanvas
  5. Refactor Portal.view.news.tickets.TimelineCanvas

Common Logic to Extract:

  • isCanvasReady_ config and theme syncing
  • afterSetOffscreenRegistered lifecycle (calls the dynamic import and initGraph)
  • ResizeObserver registration
  • updateSize logic (communicates with getRenderer())
  • Event forwarding (onClick, onMouseMove, onMouseLeave)
  • getCanvasId logic
  • getRenderer() helper using Neo.ns()
tobiu added the ai label on Jan 19, 2026, 12:59 PM
tobiu added the refactoring label on Jan 19, 2026, 12:59 PM
tobiu cross-referenced by #8807 on Jan 19, 2026, 1:00 PM
tobiu
tobiu Jan 19, 2026, 1:18 PM

Input from Gemini 3 Pro:

✦ Implemented Portal.view.shared.Canvas base class and refactored the following components to extend it:

  • Portal.view.home.parts.hero.Canvas
  • Portal.view.services.Canvas
  • Portal.view.HeaderCanvas
  • Portal.view.news.tickets.TimelineCanvas

This unifies lifecycle management, resize observation, and event bridging, using the rendererClassName and renderer getter pattern. Duplicated logic has been removed.

tobiu assigned to @tobiu on Jan 19, 2026, 1:18 PM
tobiu referenced in commit 9b0df00 - "refactor: Introduce Portal.view.shared.Canvas base class (#8808) on Jan 19, 2026, 1:18 PM
tobiu closed this issue on Jan 19, 2026, 1:19 PM