88228[TASK] Implement reactive nodes for tree-component
Commit message
Review
-
Code review CR 0
-
Verified V 0
- core-ci +1 CI
Files 2
Review log 67
-
Ayke Halder uploaded patch set 1 02/15/25, 13:55
-
core-ci voted on patch set 1 V +1 02/15/25, 14:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74181
-
Benjamin Franzke commented on patch set 1 02/17/25, 11:06
I'm not convinced premature updatedtree.ts:515This changes the incoming array (which is an object in JavaScript, therefore passed by reference!). Check: ``` function bar(a) { a.push(4) } const foo = [1, 2, 3]; bar(foo); // prints [ 1, 2, 3, 4 ] console.log(foo); ``` `[...nodes, node]` was used on purpose to ensure we're creating a new array without modifying incoming structures. -
Ayke Halder commented on patch set 1 02/18/25, 11:05
This change is ready for review.tree.ts:515ReplyThe variables are not named clearly here: Actually the code does this: ``` const enhancedNodes = nodes.reduce((nodesAccumulator: TreeNodeInterface[], node: TreeNodeInterface) => { if (node.__processed === true) { nodesAccumulator.push(node); return nodesAccumulator; } } ``` See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce#callbackfn -
Ayke Halder marked it work in progress 02/18/25, 11:06
-
Ayke Halder commented on patch set 1 02/18/25, 13:17
tree.ts:515Reply UnresolvedThe `initialValue = []` for `reduce` method is missing in the code above. Complete example: ```js const foo = [1, 2, 3]; // prints [ 1, 2, 3 ] console.log(foo); const bar = foo.reduce( (foo, node) => { foo.push(node + 'reduced'); return foo; }, [] ); // prints [ 1, 2, 3 ] console.log(foo); // prints [ '1reduced', '2reduced', '3reduced' ] console.log(bar); ``` -
Ayke Halder abandoned the change 11/10/26, 11:03
Needs another attempt for completion.