## Description
This reverts commit dbcc643ccf.
Fixes #16378
## Type of change
- Revert changes which impacted performance
## How Has This Been Tested?
Manual performance verification
@ramsaptami
## Checklist:
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
Co-authored-by: ohansFavour <fohanekwu@gmail.com>
This commit is contained in:
parent
0163c22003
commit
55082812b2
|
|
@ -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");
|
||||
});
|
||||
});
|
||||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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>,
|
||||
dataTree: Readonly<DataTree>,
|
||||
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;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1297,7 +1297,6 @@ export default class DataTreeEvaluator {
|
|||
clearErrors() {
|
||||
this.errors = [];
|
||||
}
|
||||
|
||||
clearLogs() {
|
||||
this.logs = [];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<string, any> = {};
|
||||
///// 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<string, any>,
|
||||
logs: unknown[] = [],
|
||||
) {
|
||||
const clonedDataTree = klona(dataTree);
|
||||
return (function() {
|
||||
/**** Setting the eval context ****/
|
||||
const GLOBAL_DATA: Record<string, any> = {
|
||||
|
|
@ -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];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user