-
Notifications
You must be signed in to change notification settings - Fork 4k
Break up AppNode into separate files #12809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
✅ PR preview is ready!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the monolithic AppNode.ts file by breaking it into separate, focused modules within a new render-tree directory structure. The refactoring improves code organization without changing functionality, making the codebase more maintainable as the AppNode tree hierarchy continues to evolve.
Key Changes:
- Extracted the large AppNode.ts file into separate specialized files
- Created a new
render-treedirectory to contain the tree-related modules - Moved existing tests to accompany their respective modules
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/lib/src/AppNode.ts | Converted to a simple re-export module that maintains backward compatibility |
| frontend/lib/src/render-tree/AppNode.interface.ts | Extracted the AppNode interface definition with comprehensive documentation |
| frontend/lib/src/render-tree/AppRoot.ts | Extracted the AppRoot class and related interfaces for managing the data tree root |
| frontend/lib/src/render-tree/BlockNode.ts | Extracted the BlockNode class for container nodes that hold children |
| frontend/lib/src/render-tree/ElementNode.ts | Extracted the ElementNode class for leaf nodes containing single elements |
| frontend/lib/src/render-tree/test-utils.ts | Extracted shared test utilities and helper functions |
| frontend/lib/src/render-tree/AppRoot.test.ts | Moved AppRoot-specific tests to accompany the extracted class |
| frontend/lib/src/render-tree/BlockNode.test.ts | Moved BlockNode-specific tests to accompany the extracted class |
| frontend/lib/src/render-tree/ElementNode.test.ts | Moved ElementNode-specific tests to accompany the extracted class |
671f483 to
dcda273
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
frontend/lib/src/render-tree/test-utils.ts:1
- Corrected spelling of 'NamedDataset' to 'NamedDataSet' for consistency.
/**
dcda273 to
fd9ced5
Compare
📈 Frontend coverage change detectedThe frontend unit test (vitest) coverage has increased by 0.0100%
✅ Coverage change is within normal range. |
fd9ced5 to
0004f15
Compare
0004f15 to
da3475c
Compare
da3475c to
7627ccb
Compare
48d1cd6 to
50e7ec0
Compare
7627ccb to
f5f6301
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.
Comments suppressed due to low confidence (1)
frontend/lib/src/render-tree/AppRoot.test.ts:1
- The refactored AppRoot tests are missing several test cases from the original file. Specifically missing: tests for query parameter variations ('?embed_options=hide_loading_screen', '?embed_options=show_loading_screen_v1', '?embed_options=show_loading_screen_v2'), the test for v1 loading screen on non-initial render, and the logo passing test. These should be included to maintain coverage parity.
/**
09805fb to
89ad1a4
Compare
f5f6301 to
17e8ba1
Compare
89ad1a4 to
6b854af
Compare
17e8ba1 to
19b19a3
Compare
📉 Python coverage change detectedThe Python unit test coverage has decreased by 0.0050%
✅ Coverage change is within normal range. Coverage by files
|
| */ | ||
| export const NO_SCRIPT_RUN_ID = "NO_SCRIPT_RUN_ID" | ||
|
|
||
| /** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's great that this also adds more documentation and explanation of how this works 🙌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this isn't new! But it is more noticeable now 😆
| public static empty( | ||
| mainScriptHash = "", | ||
| isInitialRender = true, | ||
| sidebarElements?: BlockNode, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[suggestion] It could add some helpful documentation to indicate under which circumstances we would initialize the AppRoot with a sidebar sub-tree, and when this might be empty.
sfc-gh-lwilby
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM -- it took me a bit to realize that this is purely just moving the code, right? I was not familiar enough with the original code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked for expected code/comments transferred into respective files, LGTM 👍🏼
Two little things:
- Looks like the e2e tests/snaps from merged PR also still in the diff here
- Should
render-treebeRenderTreein file names? (ex:frontend/lib/src/render-tree/AppNode.interface.ts)
sfc-gh-nbellante
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One q, but otherwise lgtm.
19b19a3 to
d469706
Compare
@mayagbarnes to answer this question, I am perhaps thinking back to the frontend split work, and I can imagine a library called |

Describe your changes
Refactored the AppNode into separate files. Besides the fact that AppNode has expanded to an unwieldy file. This change is the beginning of an adjustment to the AppNode tree hierarchy.
Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.