diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/BugTests/DataTree_Mutation_spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/BugTests/DataTree_Mutation_spec.ts deleted file mode 100644 index 15a76ecd20..0000000000 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/BugTests/DataTree_Mutation_spec.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { ObjectsRegistry } from "../../../../support/Objects/Registry"; - -const { - AggregateHelper: agHelper, - ApiPage, - JSEditor: jsEditor -} = ObjectsRegistry; - -const jsObjectBody = `export default { - mutateValue: function (){ - const response = Api1.data - response.users[0].name = "__" + response.users[0].name - return response.users[0].name - }, -}`; - -describe("Data mutation tests", () => { - it("1. #14699 Mutate Api response and verify it doesn't use previous mutated values", () => { - ApiPage.CreateAndFillApi("https://mock-api.appsmith.com/users"); - ApiPage.RunAPI(); - - // create js object - jsEditor.CreateJSObject(jsObjectBody, { - paste: true, - completeReplace: true, - toRun: false, - shouldCreateNewJSObj: true, - }); - - // verify that response string has __ in the start - agHelper.GetNClick(jsEditor._runButton); - agHelper.AssertContains("mutateValue ran successfully"); - agHelper.AssertContains(/^__[a-zA-Z]+/, "exist"); - - agHelper.WaitUntilAllToastsDisappear(); - - // verify that response string has __ in the start and not more "__" got appended during 2nd run - agHelper.GetNClick(jsEditor._runButton); - agHelper.ValidateToastMessage("mutateValue ran successfully"); - agHelper.AssertContains(/^__[a-zA-Z]+/, "exist"); - }); -}); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/GenerateCRUD/Postgres_Spec.ts b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/GenerateCRUD/Postgres_Spec.ts index e8eeddfe9d..2cda8333b2 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/GenerateCRUD/Postgres_Spec.ts +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/GenerateCRUD/Postgres_Spec.ts @@ -327,11 +327,9 @@ describe("Validate Postgres Generate CRUD with JSON Form", () => { deployMode.ClearJSONFieldValue("Current Port"); deployMode.EnterJSONInputValue("Current Port", "BAYONNE"); - }); it("9. Verify Update data from Deploy page - on Vessels - existing record", () => { - updateNVerify(5, 2, "DISNEY DREAM"); table.ReadTableRowColumnData(5, 3, 200).then(($cellData) => { expect($cellData).to.eq("France"); @@ -507,7 +505,7 @@ describe("Validate Postgres Generate CRUD with JSON Form", () => { }); it("14. Update JSON fields with placeholds for Addition - on Vessels", () => { - testTimeout(seconds(600));//10mins + testTimeout(seconds(600)); //10mins ee.ExpandCollapseEntity("WIDGETS"); ee.ExpandCollapseEntity("Insert_Modal"); ee.SelectEntityByName("insert_form"); @@ -766,8 +764,8 @@ describe("Validate Postgres Generate CRUD with JSON Form", () => { ) { agHelper.ClickButton("Update"); //Update does not work, Bug 14063 agHelper.AssertElementAbsence(locator._toastMsg); //Validating fix for Bug 14063 - for common table columns - //agHelper.Sleep(2000); //for update to reflect! - agHelper.WaitUntilEleDisappear(locator._spinner); + agHelper.Sleep(2000); //for update to reflect! + // agHelper.WaitUntilEleDisappear(locator._spinner); agHelper.ValidateNetworkStatus("@postExecute", 200); agHelper.ValidateNetworkStatus("@postExecute", 200); table.AssertSelectedRow(rowIndex); //Validate Primary key column selection @@ -795,9 +793,9 @@ describe("Validate Postgres Generate CRUD with JSON Form", () => { }})}}`, ); // {{[...new Set(["Cargo", "Pleasure Craft", "Passenger", "Passenger", "Fishing", "Special Craft"])].map(item=> {return { - // label: item, - // value: item - // }})}} + // label: item, + // value: item + // }})}} propPane.NavigateBackToPropertyPane(); propPane.OpenJsonFormFieldSettings("Timezone"); diff --git a/app/client/src/workers/Actions.ts b/app/client/src/workers/Actions.ts index 3c8f44b49b..3522f7db25 100644 --- a/app/client/src/workers/Actions.ts +++ b/app/client/src/workers/Actions.ts @@ -8,6 +8,7 @@ import { } from "entities/DataTree/actionTriggers"; import { NavigationTargetType } from "sagas/ActionExecution/NavigateActionSaga"; import { promisifyAction } from "workers/PromisifyAction"; +import { klona } from "klona/full"; import uniqueId from "lodash/uniqueId"; declare global { interface Window { @@ -263,11 +264,12 @@ export const DATA_TREE_FUNCTIONS: Record< }; export const enhanceDataTreeWithFunctions = ( - clonedDataTree: Readonly, + dataTree: Readonly, requestId = "", // Whether not to add functions like "run", "clear" to entity skipEntityFunctions = false, ): DataTree => { + const clonedDT = klona(dataTree); self.TRIGGER_COLLECTOR = []; Object.entries(DATA_TREE_FUNCTIONS).forEach(([name, funcOrFuncCreator]) => { if ( @@ -275,13 +277,13 @@ export const enhanceDataTreeWithFunctions = ( "qualifier" in funcOrFuncCreator ) { !skipEntityFunctions && - Object.entries(clonedDataTree).forEach(([entityName, entity]) => { + Object.entries(dataTree).forEach(([entityName, entity]) => { if (funcOrFuncCreator.qualifier(entity)) { const func = funcOrFuncCreator.func(entity); const funcName = `${funcOrFuncCreator.path || `${entityName}.${name}`}`; _.set( - clonedDataTree, + clonedDT, funcName, pusher.bind( { @@ -295,7 +297,7 @@ export const enhanceDataTreeWithFunctions = ( }); } else { _.set( - clonedDataTree, + clonedDT, name, pusher.bind( { @@ -308,7 +310,7 @@ export const enhanceDataTreeWithFunctions = ( } }); - return clonedDataTree; + return clonedDT; }; /** diff --git a/app/client/src/workers/DataTreeEvaluator/index.ts b/app/client/src/workers/DataTreeEvaluator/index.ts index 304c1e59f1..3159ea8fff 100644 --- a/app/client/src/workers/DataTreeEvaluator/index.ts +++ b/app/client/src/workers/DataTreeEvaluator/index.ts @@ -1297,7 +1297,6 @@ export default class DataTreeEvaluator { clearErrors() { this.errors = []; } - clearLogs() { this.logs = []; } diff --git a/app/client/src/workers/evaluate.ts b/app/client/src/workers/evaluate.ts index 32652d805a..e6752096df 100644 --- a/app/client/src/workers/evaluate.ts +++ b/app/client/src/workers/evaluate.ts @@ -12,7 +12,6 @@ import { enhanceDataTreeWithFunctions } from "./Actions"; import { isEmpty } from "lodash"; import { completePromise } from "workers/PromisifyAction"; import { ActionDescription } from "entities/DataTree/actionTriggers"; -import { klona } from "klona/full"; export type EvalResult = { result: any; @@ -121,7 +120,6 @@ export const createGlobalData = (args: createGlobalDataArgs) => { resolvedFunctions, skipEntityFunctions, } = args; - const clonedDataTree = klona(dataTree); const GLOBAL_DATA: Record = {}; ///// Adding callback data @@ -141,7 +139,7 @@ export const createGlobalData = (args: createGlobalDataArgs) => { if (isTriggerBased) { //// Add internal functions to dataTree; const dataTreeWithFunctions = enhanceDataTreeWithFunctions( - clonedDataTree, + dataTree, context?.requestId, skipEntityFunctions, ); @@ -150,8 +148,8 @@ export const createGlobalData = (args: createGlobalDataArgs) => { GLOBAL_DATA[datum] = dataTreeWithFunctions[datum]; }); } else { - Object.keys(clonedDataTree).forEach((datum) => { - GLOBAL_DATA[datum] = clonedDataTree[datum]; + Object.keys(dataTree).forEach((datum) => { + GLOBAL_DATA[datum] = dataTree[datum]; }); } if (!isEmpty(resolvedFunctions)) { @@ -350,7 +348,6 @@ export function isFunctionAsync( resolvedFunctions: Record, logs: unknown[] = [], ) { - const clonedDataTree = klona(dataTree); return (function() { /**** Setting the eval context ****/ const GLOBAL_DATA: Record = { @@ -358,7 +355,7 @@ export function isFunctionAsync( IS_ASYNC: false, }; //// Add internal functions to dataTree; - const dataTreeWithFunctions = enhanceDataTreeWithFunctions(clonedDataTree); + const dataTreeWithFunctions = enhanceDataTreeWithFunctions(dataTree); ///// Adding Data tree with functions Object.keys(dataTreeWithFunctions).forEach((datum) => { GLOBAL_DATA[datum] = dataTreeWithFunctions[datum];