Frontmatter
| id | 8926 |
| title | Refactor: ComponentService.serializeComponent to use object parameter |
| state | Closed |
| labels | airefactoring |
| assignees | tobiu |
| createdAt | Jan 31, 2026, 5:24 PM |
| updatedAt | Jan 31, 2026, 5:28 PM |
| githubUrl | https://github.com/neomjs/neo/issues/8926 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jan 31, 2026, 5:28 PM |
Refactor: ComponentService.serializeComponent to use object parameter
tobiu assigned to @tobiu on Jan 31, 2026, 5:24 PM

tobiu
Jan 31, 2026, 5:28 PM
Input from Gemini 3 Pro:
✦ I have successfully refactored
serializeComponentto use a single object parameter.Changes:
- Refactoring: Updated
src/ai/client/ComponentService.mjsto change theserializeComponentsignature from(component, maxDepth, currentDepth=1, lean=true)to({component, currentDepth=1, lean=true, maxDepth=-1}).- Call Site: Updated the call in
getComponentTreeand the recursive self-call to use the new object signature.- Clean Up: Verified the changes with
git diffand pushed todev.This change makes the API more robust and extensible for future flags.
tobiu closed this issue on Jan 31, 2026, 5:28 PM
The
serializeComponentmethod insrc/ai/client/ComponentService.mjscurrently 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.