Conversation
…ering code Co-authored-by: L3P3 <4629449+L3P3@users.noreply.github.com>
Co-authored-by: L3P3 <4629449+L3P3@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR enforces that components used with node_map must call hook_dom() to define their root DOM element, enabling significant simplification of the reordering logic.
Changes:
- Added debug assertion to catch missing
hook_dom()calls innode_mapcomponents - Simplified reordering by replacing recursive DOM traversal with direct
child.domaccess - Removed ~50 lines of workaround code (
instance_dom_last_getandinstance_reinsert) - Added documentation to README explaining the new requirement
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/lui.js | Added debug assertion for hook_dom requirement; simplified reordering logic; removed recursive DOM traversal functions |
| README.md | Documented that node_map components must use hook_dom |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/lui.js
Outdated
| !child.dom && | ||
| error('node_map item components must call hook_dom() to define their root DOM element'); | ||
|
|
||
| child.dom && |
There was a problem hiding this comment.
This condition is not needed anymore, right?
Also look for other similar cases around here.
We rely on child.dom existing!
There was a problem hiding this comment.
Correct. Removed all redundant child.dom && checks (lines 983, 991) and simplified the dom_first assignment (lines 1026-1030) since we now rely on child.dom always existing. Addressed in b916bd8.
Co-authored-by: L3P3 <4629449+L3P3@users.noreply.github.com>
instance_dom_last_getfunctioninstance_reinsertfunctionchild.domchild.dom &&checks now that hook_dom is enforcedOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.