LearnNewsExamplesServices
Frontmatter
id8956
titleRefactor: Move `defaults` Serialization to `ComponentColumn.toJSON`
stateClosed
labels
airefactoringcore
assigneestobiu
createdAtFeb 2, 2026, 11:58 PM
updatedAtFeb 3, 2026, 12:00 AM
githubUrlhttps://github.com/neomjs/neo/issues/8956
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtFeb 3, 2026, 12:00 AM

Refactor: Move defaults Serialization to ComponentColumn.toJSON

Closed v12.0.0 airefactoringcore
tobiu
tobiu commented on Feb 2, 2026, 11:58 PM

Goal

Consolidate the toJSON serialization logic for defaults into Neo.grid.column.Component to avoid code duplication in subclasses.

Scope

  1. Update src/grid/column/Component.mjs:
    • Modify toJSON to include defaults, using me.serializeConfig(me.defaults) if it exists.
  2. Update src/grid/column/Sparkline.mjs:
    • Remove the overridden toJSON method.
  3. Update src/grid/column/Progress.mjs:
    • Remove the overridden toJSON method.

Motivation

Both Sparkline and Progress columns override toJSON solely to serialize the defaults config. Moving this to the base class Neo.grid.column.Component DRYs up the code and ensures all component columns serialize correctly by default.

tobiu added the ai label on Feb 2, 2026, 11:58 PM
tobiu added the refactoring label on Feb 2, 2026, 11:58 PM
tobiu added the core label on Feb 2, 2026, 11:58 PM
tobiu referenced in commit 322d0b5 - "refactor: Move defaults Serialization to ComponentColumn.toJSON (#8956)" on Feb 3, 2026, 12:00 AM
tobiu assigned to @tobiu on Feb 3, 2026, 12:00 AM
tobiu
tobiu Feb 3, 2026, 12:00 AM

Input from Gemini 3 Pro:

✦ I have successfully moved the defaults serialization logic to the base class Neo.grid.column.Component.

Changes:

  1. Updated Neo.grid.column.Component: The toJSON method now checks for me.defaults and serializes it if present. This ensures that any component column utilizing defaults will have them correctly passed to the Neural Link.
  2. Cleaned up Subclasses: Removed the redundant toJSON overrides from both Neo.grid.column.Sparkline and Neo.grid.column.Progress.

This refactoring reduces code duplication and ensures a consistent behavior for all component columns.

tobiu closed this issue on Feb 3, 2026, 12:00 AM