Skip to content

Commit

Permalink
fix: JSObject function is not defined error (#35035)
Browse files Browse the repository at this point in the history
## Description

- Add the initial fetch all entity completion to the affectedJSObject
logic to make sure the JSObjects are defined on page change

Fixes #34681 
Fixed #34933 
## Automation

/test js

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/9998917287>
> Commit: 88f6c63
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9998917287&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.JS`
> Spec:
> <hr>Thu, 18 Jul 2024 22:05:02 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved handling of specific action types to ensure correct
identification of affected objects.
- Enhanced logic to address cases where action types are not included in
the predefined set, providing more accurate results.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
Rishabh Rathod authored Jul 19, 2024
1 parent d044155 commit 404e6e6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/client/src/ce/sagas/InferAffectedJSObjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,20 @@ import type { JSCollection } from "entities/JSCollection";
export function getAffectedJSObjectIdsFromJSAction(
action: ReduxAction<unknown> | BufferedReduxAction<unknown>,
): AffectedJSObjects {
if (action.type === ReduxActionTypes.FETCH_ALL_PAGE_ENTITY_COMPLETION) {
return {
ids: [],
isAllAffected: true,
};
}

if (!JS_ACTIONS.includes(action.type)) {
return {
ids: [],
isAllAffected: false,
};
}
// only JS actions here
action as ReduxAction<unknown>;

// When fetching JSActions fails, we need to diff all JSObjects because the reducer updates it
// to empty collection
if (
Expand Down

0 comments on commit 404e6e6

Please sign in to comment.