Review main Abandoned

88228[TASK] Implement reactive nodes for tree-component

Ayke Halder CR 0 V 0 Normal +43 −19 updated 11/10/26, 11:03

Commit message

Review

  • Code review CR 0
  • Verified V 0
    • core-ci +1 CI

Files 2

Review log 67

  1. Ayke Halder uploaded patch set 1 02/15/25, 13:55

  2. 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

  3. Benjamin Franzke commented on patch set 1 02/17/25, 11:06

    I'm not convinced premature updated

    tree.ts:515

    This 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.
  4. Ayke Halder commented on patch set 1 02/18/25, 11:05

    This change is ready for review.

    tree.ts:515 Reply

    The 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
  5. Ayke Halder marked it work in progress 02/18/25, 11:06

  6. Ayke Halder commented on patch set 1 02/18/25, 13:17

    tree.ts:515 Reply Unresolved

    The `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); ```
  7. Ayke Halder abandoned the change 11/10/26, 11:03

    Needs another attempt for completion.