Skip to content

Consolidate tree components: Tree View Files + Tree View Code - #1134

Draft
dbacomputer wants to merge 2 commits into
mainfrom
feature/reusable-tree-view-code
Draft

dbacomputer wants to merge 2 commits into
mainfrom
feature/reusable-tree-view-code

Conversation

@dbacomputer

Copy link
Copy Markdown
Collaborator

Summary

First pass toward a two-component naming convention for this design system's tree views, per design discussion:

  • Tree View Files: apollo-wind's existing TreeView (file/folder navigation). Not yet renamed in this PR.
  • Tree View Code: apollo-react's JsonTree (nested object/array/value tree). This PR surfaces it as its own discoverable Storybook entry.

Changes

  • Bug fix: flattenJsonTree threw RangeError: Maximum call stack size exceeded on large trees (e.g. the 20k-record demo). rows.push(...childRows) overflowed the JS engine's call-stack argument limit once a subtree flattened past roughly 65k rows. Switched to an explicit loop.
  • Storybook: renamed the JsonTree story group to Components/Tree View Code and added a small, editable Default story so the component can be evaluated on its own, without loading the full Node Property Panel. Added a component description documenting where it's already used (Node Property Panel Input/Output, Templates/Flow Standalone).
  • Skipped auto-generated Controls/props table (no component: reference in the story meta): JsonTree's recursive node type and several function-valued props crash Storybook's docgen renderer. Confirmed this is specific to JsonTree's prop shape, not a general docgen issue (other components with tags: ['autodocs'] render fine).

Open question for engineering review

JsonTree currently lives in apollo-react/src/canvas/components/JsonTree/, a completely different package from apollo-wind's TreeView. Storybook's top-level "Apollo Wind" vs "Apollo React/Canvas" grouping is derived from which package a story physically lives in (see apps/storybook/.storybook/main.ts), not from the story title, so Tree View Files and Tree View Code cannot appear as siblings under Apollo Wind > Components > Data Display without physically relocating JsonTree into the apollo-wind package.

That relocation is not a small mechanical move:

  • apollo-wind currently has zero dependency on apollo-react (confirmed via package.json), and the intended architecture keeps them siblings under apollo-core. Moving JsonTree in place would need to happen without pulling apollo-react in as a dependency.
  • JsonTree and its subcomponents pull in three apollo-react-internal pieces:
    • useIsomorphicLayoutEffect — trivial, copy as-is.
    • useSafeLingui (Lingui i18n) — apollo-wind has no i18n setup today; would need @lingui/core/@lingui/react added, or the hook stripped to a no-op translator.
    • CanvasTooltip / CanvasTooltipProviderMarker (used by 5+ files, itself pulling in useTruncationDetection from apollo-react's Material tooltip) — the tooltip-dedup marker is droppable for standalone use, but the truncation-aware tooltip wrapper itself needs a real decision: port it into apollo-wind, or rewrite those call sites against apollo-wind's plain Tooltip.

Needs a decision before proceeding: relocate JsonTree into apollo-wind (bigger refactor, but matches the requested nav structure), or keep it in apollo-react and accept that "Tree View Files" and "Tree View Code" live under different top-level Storybook sections.

Test plan

  • Components/Tree View Code/Default renders and edits correctly in Storybook
  • Components/Tree View Code/Virtualized Own Scroll Box, Virtualized Inside Panel, Virtualized Editable, Not Virtualized no longer crash
  • Existing Node Property Panel Input/Output stories unaffected
  • Engineering sign-off on the apollo-wind relocation question above

🤖 Generated with Claude Code

dbacomputer and others added 2 commits September 8, 2026 13:21
rows.push(...childRows) overflowed the engine's call-stack argument
limit once a subtree flattened to tens of thousands of rows (e.g. the
JsonTree stories' 20k-record demo), throwing "Maximum call stack size
exceeded" from inside the component.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…tory

Renames the JsonTree story group from "Components/JsonTree" to
"Components/Tree View Code" and adds a small, editable Default story
so the component can be evaluated on its own, without loading the
full Node Property Panel. Documents where it's already used (Node
Property Panel Input/Output, Templates/Flow Standalone) so it's
easier to find real usage examples.

Part of consolidating this design system's tree components under two
names: Tree View Files (apollo-wind's file/folder tree) and Tree View
Code (this component). Skips auto-generated Controls/props table
(no `component:` in meta): JsonTree's recursive node type and several
function-valued props crash Storybook's docgen renderer.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 8, 2026 20:22
@github-actions github-actions Bot added the size:M 30-99 changed lines. label Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Apollo Coded App preview deployments are ready.

Project Status Preview Updated (PT)
apollo-design Ready Preview · Logs Sep 08, 2026, 01:32:09 PM
apollo-docs Ready Preview · Logs Sep 08, 2026, 01:32:09 PM
apollo-landing Ready Preview · Logs Sep 08, 2026, 01:32:09 PM
apollo-vertex Ready Preview · Logs Sep 08, 2026, 01:32:09 PM

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Dependency License Review

  • 1937 package(s) scanned
  • ✅ No license issues found
  • ⚠️ 2 package(s) excluded (see details below)
License distribution
License Packages
MIT 1708
ISC 88
Apache-2.0 55
BSD-3-Clause 27
BSD-2-Clause 23
BlueOak-1.0.0 8
MPL-2.0 4
MIT-0 3
CC0-1.0 3
MIT OR Apache-2.0 2
(MIT OR Apache-2.0) 2
Unlicense 2
LGPL-3.0-or-later 1
Python-2.0 1
CC-BY-4.0 1
(MPL-2.0 OR Apache-2.0) 1
Unknown 1
Artistic-2.0 1
(WTFPL OR MIT) 1
(BSD-2-Clause OR MIT OR Apache-2.0) 1
CC-BY-3.0 1
0BSD 1
(MIT OR CC0-1.0) 1
MIT AND ISC 1
Excluded packages
Package Version License Reason
@img/sharp-libvips-linux-x64 1.3.2 LGPL-3.0-or-later LGPL pre-built binary, not linked
khroma 2.1.0 Unknown MIT per GitHub repo, missing license field in package.json

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The bug fix lacks a regression unit test for the large-row flattening scenario, despite existing flattenJsonTree test coverage in the same component area.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR is a first step toward the “Tree View Files” vs “Tree View Code” naming convention by making JsonTree discoverable in Storybook under a new “Tree View Code” entry, and it fixes a flattenJsonTree runtime crash when flattening very large trees.

Changes:

  • Fixed flattenJsonTree crashing on large trees by removing the rows.push(...childRows) spread and pushing rows via an explicit loop.
  • Renamed the JsonTree Storybook group to Components/Tree View Code and enabled autodocs with a custom component description.
  • Added a small editable Default story to evaluate JsonTree standalone (outside the full panel UI).
File summaries
File Description
packages/apollo-react/src/canvas/components/JsonTree/JsonTree.stories.tsx Renames Storybook entry to “Tree View Code”, adds autodocs description, and introduces a standalone editable Default story.
packages/apollo-react/src/canvas/components/JsonTree/buildJsonTree.ts Fixes large-tree flattening crash by avoiding spread-into-push with very large row arrays.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +343 to +347
// Not `rows.push(...childRows)`: spreading tens of thousands of arguments
// into `push` overflows the engine's call-stack argument limit.
for (const row of flattenJsonTree(node.children, childOptions, depth + 1)) {
rows.push(row);
}
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

📊 Coverage + size by package

Per-package coverage and bundle size on this PR. New-line coverage = of the source lines this PR adds or changes, the % hit by tests.

Package Coverage New-line coverage Packed (gzip) Unpacked vs main
@uipath/apollo-core 42.01 MB 50.12 MB ±0
@uipath/apollo-react 39.9% 22.2% (2/9) 7.56 MB 29.15 MB +21 B
@uipath/apollo-ui-icons 2.85 MB 6.91 MB ±0
@uipath/apollo-wind 447.7 KB 2.85 MB −6 B
@uipath/ap-chat 85.8% 43.92 MB 56.68 MB ±0

"Coverage" is each package's own coverage.include scope (e.g. apollo-core instruments only scripts/). "Packed"/"Unpacked" come from npm pack --dry-run and only cover built packages — "—" means not measured this run (package not affected / not built). "vs main" is the packed (gzipped) delta against the last successful main build (the package-sizes artifact from the Release workflow); "—" there means no main baseline was available this run. The baseline is main's latest build, not this PR's exact merge-base, so it includes any drift since the branch diverged. Packages with no vitest config are omitted.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Storybook visual diff

⚠️ Visual changes detected: 6 changed, 5 added, 4 removed (of 373 compared, 358 unchanged). View report

Baseline is the deployed main Storybook, so changes merged to main after this branch was last updated can also appear here. Logs

Updated (PT): Sep 08, 2026, 01:48:55 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg:apollo-react size:M 30-99 changed lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants