-
Notifications
You must be signed in to change notification settings - Fork 4.1k
chore: remove redundant klona used by the reactive action flow #41089
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
WalkthroughThis change removes the usage and passing of the old evaluation tree ( Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant DataTreeEvaluator
Caller->>DataTreeEvaluator: evalAndValidateSubTree(evaluationOrder, configTree, unevalUpdates, metaWidgetIds)
DataTreeEvaluator->>DataTreeEvaluator: getPrevState()
DataTreeEvaluator-->>Caller: {evalMetaUpdates, staleMetaIds, contextTree, executeReactiveActions}
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
app/client/src/workers/Evaluation/__tests__/evaluation.test.ts
(0 hunks)app/client/src/workers/Evaluation/evalTreeWithChanges.test.ts
(0 hunks)app/client/src/workers/Evaluation/evalTreeWithChanges.ts
(0 hunks)app/client/src/workers/Evaluation/handlers/evalTree.ts
(0 hunks)app/client/src/workers/Evaluation/handlers/evalTrigger.ts
(0 hunks)app/client/src/workers/common/DataTreeEvaluator/dataTreeEvaluator.test.ts
(0 hunks)app/client/src/workers/common/DataTreeEvaluator/index.ts
(1 hunks)
💤 Files with no reviewable changes (6)
- app/client/src/workers/Evaluation/handlers/evalTree.ts
- app/client/src/workers/Evaluation/evalTreeWithChanges.test.ts
- app/client/src/workers/common/DataTreeEvaluator/dataTreeEvaluator.test.ts
- app/client/src/workers/Evaluation/tests/evaluation.test.ts
- app/client/src/workers/Evaluation/handlers/evalTrigger.ts
- app/client/src/workers/Evaluation/evalTreeWithChanges.ts
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: appsmithorg/appsmith#0
File: .cursor/rules/index.mdc:0-0
Timestamp: 2025-06-23T12:22:10.042Z
Learning: Pull request titles in the Appsmith codebase should follow the Conventional Commits specification, using the format 'type(scope): description' with valid types such as feat, fix, docs, style, refactor, perf, test, build, ci, chore, and revert.
Learnt from: ashit-rath
PR: appsmithorg/appsmith#33809
File: app/client/src/workers/Evaluation/evaluate.ts:31-31
Timestamp: 2024-07-26T21:12:57.228Z
Learning: User prefers to handle extensive changes like improving type safety by replacing `any` with more specific types in a separate PR to manage the scope effectively.
Learnt from: Aishwarya-U-R
PR: appsmithorg/appsmith#29405
File: app/client/cypress/e2e/Regression/ClientSide/Binding/TableV2_Widget_API_Pagination_spec.js:37-41
Timestamp: 2024-10-08T15:32:39.374Z
Learning: The pull request titled "test: Cypress | Replace static with Dynamic waits - Part 1" is part of a phased approach where only certain test specifications are targeted for static wait removal in the initial phase. Future phases will address additional specs.
Learnt from: Aishwarya-U-R
PR: appsmithorg/appsmith#29405
File: app/client/cypress/e2e/Regression/ClientSide/Binding/TableV2_Widget_API_Pagination_spec.js:37-41
Timestamp: 2024-07-26T21:12:57.228Z
Learning: The pull request titled "test: Cypress | Replace static with Dynamic waits - Part 1" is part of a phased approach where only certain test specifications are targeted for static wait removal in the initial phase. Future phases will address additional specs.
Learnt from: sneha122
PR: appsmithorg/appsmith#30012
File: app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx:679-682
Timestamp: 2024-10-08T15:32:34.115Z
Learning: The user `sneha122` has confirmed the resolution of the feedback regarding the redundancy of `|| false` in the `_.get` expression within the `RestAPIDatasourceForm.tsx` file.
Learnt from: sneha122
PR: appsmithorg/appsmith#30012
File: app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx:679-682
Timestamp: 2024-07-26T21:12:57.228Z
Learning: The user `sneha122` has confirmed the resolution of the feedback regarding the redundancy of `|| false` in the `_.get` expression within the `RestAPIDatasourceForm.tsx` file.
Learnt from: saiprabhu-dandanayak
PR: appsmithorg/appsmith#33911
File: app/client/src/api/TemplatesApi.ts:0-0
Timestamp: 2024-10-08T15:32:39.374Z
Learning: User saiprabhu-dandanayak has confirmed the removal of the `any` type in the TypeScript code for better type safety in the `TemplatesApi.ts` file.
Learnt from: saiprabhu-dandanayak
PR: appsmithorg/appsmith#33911
File: app/client/src/api/TemplatesApi.ts:0-0
Timestamp: 2024-07-26T21:12:57.228Z
Learning: User saiprabhu-dandanayak has confirmed the removal of the `any` type in the TypeScript code for better type safety in the `TemplatesApi.ts` file.
Learnt from: ashit-rath
PR: appsmithorg/appsmith#37912
File: app/client/src/git/components/QuickActions/helpers.ts:22-25
Timestamp: 2024-12-03T10:13:43.282Z
Learning: In `app/client/src/git/components/QuickActions/helpers.ts`, the unnecessary `@ts-ignore` comments will be removed in future PRs.
Learnt from: brayn003
PR: appsmithorg/appsmith#40462
File: app/client/src/instrumentation/index.ts:0-0
Timestamp: 2025-04-29T09:12:14.552Z
Learning: Only comment on files that are directly related to the PR's objectives, even if other files appear in the diff. For PR #40462, the focus is on the import override feature for artifacts, not on instrumentation or telemetry files.
Learnt from: AmanAgarwal041
PR: appsmithorg/appsmith#36539
File: app/client/src/workers/Evaluation/handlers/jsLibrary.ts:329-329
Timestamp: 2024-09-25T18:58:34.275Z
Learning: In `app/client/src/workers/Evaluation/handlers/jsLibrary.ts`, when removing keys from `self`, use `delete` to completely remove the property, as assigning `undefined` leaves the key in the object and can affect subsequent difference checks.
Learnt from: AmanAgarwal041
PR: appsmithorg/appsmith#36539
File: app/client/src/workers/Evaluation/handlers/jsLibrary.ts:329-329
Timestamp: 2024-10-08T15:32:39.374Z
Learning: In `app/client/src/workers/Evaluation/handlers/jsLibrary.ts`, when removing keys from `self`, use `delete` to completely remove the property, as assigning `undefined` leaves the key in the object and can affect subsequent difference checks.
Learnt from: ashit-rath
PR: appsmithorg/appsmith#33809
File: app/client/src/workers/common/DataTreeEvaluator/test.ts:196-196
Timestamp: 2024-07-26T21:12:57.228Z
Learning: In test cases within `DataTreeEvaluator/test.ts`, type safety is not a priority, and using `any` is acceptable for flexibility as per user ashit-rath.
Learnt from: ashit-rath
PR: appsmithorg/appsmith#33809
File: app/client/src/workers/common/DataTreeEvaluator/test.ts:196-196
Timestamp: 2024-10-08T15:32:34.115Z
Learning: In test cases within `DataTreeEvaluator/test.ts`, type safety is not a priority, and using `any` is acceptable for flexibility as per user ashit-rath.
app/client/src/workers/common/DataTreeEvaluator/index.ts (11)
Learnt from: AmanAgarwal041
PR: appsmithorg/appsmith#36539
File: app/client/src/workers/Evaluation/handlers/jsLibrary.ts:329-329
Timestamp: 2024-10-08T15:32:39.374Z
Learning: In `app/client/src/workers/Evaluation/handlers/jsLibrary.ts`, when removing keys from `self`, use `delete` to completely remove the property, as assigning `undefined` leaves the key in the object and can affect subsequent difference checks.
Learnt from: AmanAgarwal041
PR: appsmithorg/appsmith#36539
File: app/client/src/workers/Evaluation/handlers/jsLibrary.ts:329-329
Timestamp: 2024-09-25T18:58:34.275Z
Learning: In `app/client/src/workers/Evaluation/handlers/jsLibrary.ts`, when removing keys from `self`, use `delete` to completely remove the property, as assigning `undefined` leaves the key in the object and can affect subsequent difference checks.
Learnt from: ashit-rath
PR: appsmithorg/appsmith#33809
File: app/client/src/workers/common/DataTreeEvaluator/test.ts:196-196
Timestamp: 2024-07-26T21:12:57.228Z
Learning: In test cases within `DataTreeEvaluator/test.ts`, type safety is not a priority, and using `any` is acceptable for flexibility as per user ashit-rath.
Learnt from: ashit-rath
PR: appsmithorg/appsmith#33809
File: app/client/src/workers/common/DataTreeEvaluator/test.ts:196-196
Timestamp: 2024-10-08T15:32:34.115Z
Learning: In test cases within `DataTreeEvaluator/test.ts`, type safety is not a priority, and using `any` is acceptable for flexibility as per user ashit-rath.
Learnt from: saiprabhu-dandanayak
PR: appsmithorg/appsmith#33911
File: app/client/src/api/TemplatesApi.ts:0-0
Timestamp: 2024-10-08T15:32:39.374Z
Learning: User saiprabhu-dandanayak has confirmed the removal of the `any` type in the TypeScript code for better type safety in the `TemplatesApi.ts` file.
Learnt from: saiprabhu-dandanayak
PR: appsmithorg/appsmith#33911
File: app/client/src/api/TemplatesApi.ts:0-0
Timestamp: 2024-07-26T21:12:57.228Z
Learning: User saiprabhu-dandanayak has confirmed the removal of the `any` type in the TypeScript code for better type safety in the `TemplatesApi.ts` file.
Learnt from: sharat87
PR: appsmithorg/appsmith#37715
File: app/client/packages/rts/src/ctl/backup/BackupState.ts:4-11
Timestamp: 2024-11-28T07:23:54.455Z
Learning: In the `BackupState` class in `app/client/packages/rts/src/ctl/backup/BackupState.ts`, validation for `backupRootPath` and `archivePath` properties is unnecessary because users don't have influence over these values.
Learnt from: ashit-rath
PR: appsmithorg/appsmith#37912
File: app/client/src/git/components/QuickActions/helpers.ts:22-25
Timestamp: 2024-12-03T10:13:43.282Z
Learning: In `app/client/src/git/components/QuickActions/helpers.ts`, the unnecessary `@ts-ignore` comments will be removed in future PRs.
Learnt from: riodeuno
PR: appsmithorg/appsmith#33070
File: app/client/src/layoutSystems/anvil/integrations/sagas/anvilWidgetSelectionSaga.ts:94-103
Timestamp: 2024-07-26T21:12:57.228Z
Learning: The `getErrorPropertyPath` function in `anvilWidgetSelectionSaga.ts` includes a temporary fix to handle cases where no errors are found by returning an empty string. This is planned to be removed in the future.
Learnt from: riodeuno
PR: appsmithorg/appsmith#33070
File: app/client/src/layoutSystems/anvil/integrations/sagas/anvilWidgetSelectionSaga.ts:94-103
Timestamp: 2024-10-08T15:32:34.115Z
Learning: The `getErrorPropertyPath` function in `anvilWidgetSelectionSaga.ts` includes a temporary fix to handle cases where no errors are found by returning an empty string. This is planned to be removed in the future.
Learnt from: ankitakinger
PR: appsmithorg/appsmith#29573
File: app/client/src/pages/Editor/Explorer/Entity/EntityProperties.tsx:46-65
Timestamp: 2024-07-26T21:12:57.228Z
Learning: The use of `any` for the `entityProperties` parameter in the `getJSActionBindings` function within `EntityProperties.tsx` is intentional and should not be suggested for refactoring to improve type safety.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: perform-test / server-build / server-unit-tests
- GitHub Check: perform-test / rts-build / build
- GitHub Check: perform-test / client-build / client-build
- GitHub Check: client-unit-tests / client-unit-tests
- GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
- GitHub Check: client-prettier / prettier-check
- GitHub Check: client-lint / client-lint
- GitHub Check: client-build / client-build
if (!propertyPath) continue; | ||
|
||
// Get old value from oldEvalTree for comparison | ||
const oldValue = get(oldEvalTree, fullPropertyPath); | ||
const oldValue = get(this.getPrevState(), fullPropertyPath); | ||
|
||
switch (entityType) { |
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.
🛠️ Refactor suggestion
prevState
is compared by reference – risk of always-equal matches
oldValue
now comes from this.getPrevState()
, but setPrevState()
stores the incoming object without cloning.
Because the same object reference can later be mutated in-place during evaluation, oldValue !== parsedValue
may never register, silently skipping valuechanged
updates and downstream reactive flows.
- setPrevState(state: any) {
- this.prevState = state;
+ setPrevState(state: DataTree) {
+ // deep-clone to break shared references
+ this.prevState = klonaJSON(state);
}
Confirm every caller of setPrevState
passes the tree before any mutation and that it is invoked on every evaluation cycle; otherwise comparisons here will be unreliable.
Failing to fix this can cause widgets/actions to miss updates, leading to stale UI and hard-to-debug reactive bugs.
Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In app/client/src/workers/common/DataTreeEvaluator/index.ts around lines 1319 to
1324, the oldValue is obtained from this.getPrevState(), but setPrevState()
stores the state object by reference without cloning, causing mutations to
affect both current and previous states and making comparisons unreliable. To
fix this, ensure that setPrevState() clones the incoming state object deeply
before storing it, so that oldValue reflects an immutable snapshot of the
previous state and value change comparisons work correctly.
Description
Removed redundant klona used by the reactive action flow.
Fixes #
Issue Number
or
Fixes
Issue URL
Warning
If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.
Automation
/ok-to-test tags="@tag.All"
🔍 Cypress test results
Tip
🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/16114695042
Commit: ac67b38
Cypress dashboard.
Tags:
@tag.All
Spec:
Mon, 07 Jul 2025 11:54:41 UTC
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit
Refactor
Tests