-
Notifications
You must be signed in to change notification settings - Fork 4k
Convert setIn to SetNodeByDeltaPathVisitor #12820
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
Convert setIn to SetNodeByDeltaPathVisitor #12820
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!
|
5cb8af0 to
f5842b6
Compare
1528c16 to
eeb90b9
Compare
9725ff2 to
9b06d11
Compare
📉 Python coverage change detectedThe Python unit test coverage has decreased by 0.0000%
✅ Coverage change is within normal range. Coverage by files
|
📈 Frontend coverage change detectedThe frontend unit test (vitest) coverage has increased by 0.0100%
✅ Coverage change is within normal range. |
223aaf7 to
9496462
Compare
9b06d11 to
17554c5
Compare
9496462 to
5cd1eaa
Compare
17554c5 to
4934ae1
Compare
807de2c to
4a7e699
Compare
5f44b36 to
4f7c717
Compare
d461b5e to
96fe649
Compare
4f7c717 to
3fc0e6d
Compare
96fe649 to
f582a47
Compare
db19c5d to
74be12a
Compare
f582a47 to
be4990a
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
This PR refactors the setIn method from AppNode implementations (BlockNode and ElementNode) to use the visitor pattern via a new SetNodeByDeltaPathVisitor. The change removes the setIn method from the AppNode interface and individual node classes, replacing all usages with the visitor-based approach.
Key Changes
- Introduced
SetNodeByDeltaPathVisitorthat implements immutable node updates via the visitor pattern - Removed
setInmethod fromAppNodeinterface,BlockNode, andElementNodeclasses - Updated
AppRootto use the new visitor pattern through a newrunActionOnAllChildrenhelper method
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| SetNodeByDeltaPathVisitor.ts | New visitor implementation for setting nodes at delta paths with immutability |
| SetNodeByDeltaPathVisitor.test.ts | Comprehensive test suite covering visitor behavior, edge cases, and integration scenarios |
| ElementNode.ts | Removed setIn method that threw an error |
| BlockNode.ts | Removed setIn method implementation |
| BlockNode.test.ts | Updated tests to use SetNodeByDeltaPathVisitor.setNodeAtPath instead of direct setIn calls |
| AppRoot.ts | Added runActionOnAllChildren helper and updated three call sites to use new visitor pattern |
| AppNode.interface.ts | Removed setIn method from interface definition |
be4990a to
cd5b495
Compare
74be12a to
fbcb3ff
Compare
| deltaPath, | ||
| elementNode, | ||
| scriptRunId | ||
| ) as 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: Consider making setNodeAtPath a generic function so that we aren't needlessly casting afterwards.
frontend/lib/src/render-tree/visitors/SetNodeByDeltaPathVisitor.test.ts
Outdated
Show resolved
Hide resolved
frontend/lib/src/render-tree/visitors/SetNodeByDeltaPathVisitor.ts
Outdated
Show resolved
Hide resolved
cd5b495 to
cbd79fb
Compare
fbcb3ff to
a1b1835
Compare
cbd79fb to
fe82e1a
Compare
ece38f4 to
e89016a
Compare
e89016a to
070a633
Compare
fe82e1a to
9d611de
Compare
070a633 to
5ea7844
Compare

Describe your changes
The last of the visitors is the SetNodeByDeltaPathVisitor which sets the node in a hiearchy.
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.