LearnNewsExamplesServices
Frontmatter
id8926
titleRefactor: ComponentService.serializeComponent to use object parameter
stateClosed
labels
airefactoring
assigneestobiu
createdAtJan 31, 2026, 5:24 PM
updatedAtJan 31, 2026, 5:28 PM
githubUrlhttps://github.com/neomjs/neo/issues/8926
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 31, 2026, 5:28 PM

Refactor: ComponentService.serializeComponent to use object parameter

Closed v12.0.0 airefactoring
tobiu
tobiu commented on Jan 31, 2026, 5:24 PM

The serializeComponent method in src/ai/client/ComponentService.mjs currently uses 4 positional arguments: serializeComponent(component, maxDepth, currentDepth=1, lean=true)

As we add more control flags (like lean), this signature is becoming unwieldy.

Goal: Refactor the method to accept a single options object: serializeComponent({component, maxDepth, currentDepth=1, lean=true})

This improves readability and makes future extensions (e.g., adding includeListeners, excludeTypes) easier without breaking the signature.

tobiu added the ai label on Jan 31, 2026, 5:24 PM
tobiu added the refactoring label on Jan 31, 2026, 5:24 PM
tobiu assigned to @tobiu on Jan 31, 2026, 5:24 PM
tobiu referenced in commit 2a18e4f - "refactor: ComponentService.serializeComponent to use object parameter (#8926)" on Jan 31, 2026, 5:28 PM
tobiu
tobiu Jan 31, 2026, 5:28 PM

Input from Gemini 3 Pro:

✦ I have successfully refactored serializeComponent to use a single object parameter.

Changes:

  1. Refactoring: Updated src/ai/client/ComponentService.mjs to change the serializeComponent signature from (component, maxDepth, currentDepth=1, lean=true) to ({component, currentDepth=1, lean=true, maxDepth=-1}).
  2. Call Site: Updated the call in getComponentTree and the recursive self-call to use the new object signature.
  3. Clean Up: Verified the changes with git diff and pushed to dev.

This change makes the API more robust and extensible for future flags.

tobiu closed this issue on Jan 31, 2026, 5:28 PM