LearnNewsExamplesServices
Frontmatter
id8951
titleFeat: Smart Initialization for SparklineComponent
stateClosed
labels
enhancementai
assigneestobiu
createdAtFeb 2, 2026, 3:01 PM
updatedAtFeb 2, 2026, 10:19 PM
githubUrlhttps://github.com/neomjs/neo/issues/8951
authortobiu
commentsCount1
parentIssue8948
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtFeb 2, 2026, 10:19 PM

Feat: Smart Initialization for SparklineComponent

Closed v12.0.0 enhancementai
tobiu
tobiu commented on Feb 2, 2026, 3:01 PM

Update DevRank.view.SparklineComponent to demonstrate the "Smart Component" pattern.

Logic:

  1. Check: On initialization, query if the Canvas Worker is available.
  2. Start: If not, call Neo.worker.Manager.startWorker('canvas').
  3. Load: Call Canvas.loadModule('apps/devrank/canvas/Sparkline.mjs').
  4. Register: Proceed with register() only after these steps succeed.

Note: This removes the need for canvas.mjs entry point edits for this component.

tobiu added the enhancement label on Feb 2, 2026, 3:01 PM
tobiu added the ai label on Feb 2, 2026, 3:01 PM
tobiu added parent issue #8948 on Feb 2, 2026, 3:01 PM
tobiu referenced in commit ef35cc8 - "feat: Smart Initialization for SparklineComponent (#8951)" on Feb 2, 2026, 10:18 PM
tobiu assigned to @tobiu on Feb 2, 2026, 10:18 PM
tobiu
tobiu Feb 2, 2026, 10:18 PM

Input from Gemini 3 Pro:

✦ Implemented smart initialization logic in SparklineComponent:

  1. initAsync Implementation:
    • Checks for Canvas Worker availability and starts it on-demand via Neo.worker.Manager.startWorker.
    • Waits for the worker to boot and register its remote methods (specifically loadModule).
    • Dynamically loads the Sparkline.mjs renderer module using Neo.worker.Canvas.loadModule.
  2. Robust Registration:
    • Updated afterSetOffscreenRegistered to await me.ready(). This ensures that the component does not attempt to register the canvas with the renderer until the initAsync sequence (and thus module loading) is fully complete.

This removes the need for manual canvas.mjs configuration for this component and prevents race conditions during startup.

tobiu closed this issue on Feb 2, 2026, 10:19 PM