collection.getChildren(node.key) deprecation confusion #4348
-
Hey folks, ive recently noticed a deprecation notice when trying to map over child nodes via
I have to use Array.from against any react-aria collection otherwise strangely, my collections do not propagate in either storybook or my browser, both of which are the latest versions, but i digress. The suggestion is to use non null assertion the long way home <thead {...theadGroupProps} className="sticky top-0" ref={headerRef}>
{state.collection.headerRows.map((headerRow) => {
const headerChildNodes =
(state.collection.getChildren &&
state.collection.getChildren(headerRow.key)) ||
new Set();
return (
<TableHeaderRow key={headerRow.key} node={headerRow} state={state}>
{Array.from(headerChildNodes).map((column) => {... Would greatly appreciate some advice in regards to moving forward with iterating over child nodes in general, would be awesome to have a geez at some examples that use the non deprecated method too, cheers folks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Yeah we're in the middle of a transition to a new collection implementation so things are moving around a bit right now. We couldn't make |
Beta Was this translation helpful? Give feedback.
Yeah we're in the middle of a transition to a new collection implementation so things are moving around a bit right now. We couldn't make
getChildren
required because that would be a breaking change for anyone implementing their own Collection. Maybe we shouldn't have added the deprecation comment just yet, not sure.