Skip to content

Return ComponentElement from factory methods (#263)#300

Merged
codemonkeychris merged 2 commits into
mainfrom
fix/263-factory-return-types
May 19, 2026
Merged

Return ComponentElement from factory methods (#263)#300
codemonkeychris merged 2 commits into
mainfrom
fix/263-factory-return-types

Conversation

@sundaramramaswamy
Copy link
Copy Markdown
Collaborator

Summary

DataGrid<T>, PropertyGrid, and VirtualList factory methods now return ComponentElement instead of the base Element type.

Why not the typed element (e.g. DataGridElement<T>)?

These factories wrap the typed element record inside a ComponentElement via Component<T,P>(props).WithKey(...). The actual runtime return value has always been ComponentElement — the declared Element return type was just less specific than it could be.

Returning the typed element (DataGridElement<T>) isn't possible without restructuring the Component wrapper pattern. ComponentElement is the most specific accurate type.

Changed files

File Change
DataGridFactories.cs Both overloads: ElementComponentElement
PropertyGridFactories.cs ElementComponentElement
VirtualListFactories.cs ElementComponentElement
reactor.api.txt (×2) Return type annotations updated

Fixes #263

DataGrid<T>, PropertyGrid, and VirtualList factory
methods now return ComponentElement instead of the
base Element type. These factories wrap typed element
records in ComponentElement via Component<T,P>(), so
ComponentElement is the accurate return type.

Fixes #263

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sundaramramaswamy
Copy link
Copy Markdown
Collaborator Author

@copilot resolve the merge conflicts in this pull request

…n-types

# Conflicts:
#	plugins/reactor/skills/reactor-dsl/references/reactor.api.txt
#	skills/reactor.api.txt

Co-authored-by: sundaramramaswamy <29264916+sundaramramaswamy@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI commented May 19, 2026

@copilot resolve the merge conflicts in this pull request

Resolved in 7f93653. The conflicts were in both reactor.api.txt files — kept ComponentElement for PropertyGrid (this PR's change) and adopted the updated parameter names (onIsCheckedChanged, onSelectedIndexChanged) that landed on main in the meantime.

@codemonkeychris codemonkeychris merged commit 5b37118 into main May 19, 2026
9 checks passed
@codemonkeychris codemonkeychris deleted the fix/263-factory-return-types branch May 19, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API consistency: factory methods return Element when a typed element type exists

3 participants