From 404e6e6ad90e7975e770975dab9715465cdd8845 Mon Sep 17 00:00:00 2001 From: Rishabh Rathod Date: Fri, 19 Jul 2024 20:25:39 +0530 Subject: [PATCH] fix: JSObject function is not defined error (#35035) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 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 ### :mag: Cypress test results > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: 88f6c636e89de881883e6d4f5d648104257977b9 > Cypress dashboard. > Tags: `@tag.JS` > Spec: >
Thu, 18 Jul 2024 22:05:02 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No ## 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. --- app/client/src/ce/sagas/InferAffectedJSObjects.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/client/src/ce/sagas/InferAffectedJSObjects.ts b/app/client/src/ce/sagas/InferAffectedJSObjects.ts index a2cd3e5d347a..4f91912ea994 100644 --- a/app/client/src/ce/sagas/InferAffectedJSObjects.ts +++ b/app/client/src/ce/sagas/InferAffectedJSObjects.ts @@ -13,14 +13,20 @@ import type { JSCollection } from "entities/JSCollection"; export function getAffectedJSObjectIdsFromJSAction( action: ReduxAction | BufferedReduxAction, ): 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; + // When fetching JSActions fails, we need to diff all JSObjects because the reducer updates it // to empty collection if (