Skip to content
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

unminified build #37593

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/client/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ export REACT_APP_SENTRY_RELEASE=$GIT_SHA
export REACT_APP_CLIENT_LOG_LEVEL=ERROR
# Disable CRA built-in ESLint checks since we have our own config and a separate step for this
export DISABLE_ESLINT_PLUGIN=true
craco --max-old-space-size=7168 build --config craco.build.config.js
CI=false craco --max-old-space-size=7168 build --config craco.build.config.js

echo "build finished"
2 changes: 2 additions & 0 deletions app/client/craco.common.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ module.exports = {
},
],
},
devtool: "source-map",
optimization: {
minimize: false,
splitChunks: {
cacheGroups: {
icons: {
Expand Down
15 changes: 13 additions & 2 deletions app/client/src/ce/workers/Evaluation/dataTreeUtils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import type { DataTree } from "entities/DataTree/dataTreeTypes";
import { isObject, set } from "lodash";
import { klona } from "klona/json";
Expand All @@ -7,6 +8,14 @@ import type { EvalProps } from "workers/common/DataTreeEvaluator";
* This method loops through each entity object of dataTree and sets the entity config from prototype as object properties.
* This is done to send back dataTree in the format expected by mainThread.
*/

const klona16 = (data: any) => {
return klona(data);
};
const klona17 = (data: any) => {
return klona(data);
};

export function makeEntityConfigsAsObjProperties(
dataTree: DataTree,
option = {} as {
Expand All @@ -25,7 +34,9 @@ export function makeEntityConfigsAsObjProperties(
: entity;
}

const dataTreeToReturn = sanitizeDataTree ? klona(newDataTree) : newDataTree;
const dataTreeToReturn = sanitizeDataTree
? klona16(newDataTree)
: newDataTree;

if (!evalProps) return dataTreeToReturn;

Expand All @@ -35,7 +46,7 @@ export function makeEntityConfigsAsObjProperties(
set(
dataTreeToReturn[entityName],
"__evaluation__",
klona({ errors: entityEvalProps.__evaluation__.errors }),
klona17({ errors: entityEvalProps.__evaluation__.errors }),
);
}

Expand Down
8 changes: 7 additions & 1 deletion app/client/src/workers/Evaluation/JSObject/Collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ export default class JSObjectCollection {
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
): VariableState | Record<string, any> {
if (!JSObjectName || !this.variableState) return klona(this.variableState);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const klona14 = (data: any) => {
return klona(data);
};

if (!JSObjectName || !this.variableState)
return klona14(this.variableState);

return this.variableState[JSObjectName];
}
Expand Down
6 changes: 5 additions & 1 deletion app/client/src/workers/Evaluation/evaluate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ export interface createEvaluationContextArgs {
* the particular entities only. This avoid unnecessary cloning of every entity and further multiple times.
*
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const klona10 = (data: any) => {
return klona(data);
};
const overrideEvalContext = (
EVAL_CONTEXT: EvalContext,
overrideContext?: Record<string, unknown>,
Expand All @@ -236,7 +240,7 @@ const overrideEvalContext = (

if (entityName in EVAL_CONTEXT && !entitiesClonedSoFar.has(entityName)) {
entitiesClonedSoFar.add(entityName);
EVAL_CONTEXT[entityName] = klona(EVAL_CONTEXT[entityName]);
EVAL_CONTEXT[entityName] = klona10(EVAL_CONTEXT[entityName]);
}
});

Expand Down
7 changes: 5 additions & 2 deletions app/client/src/workers/Evaluation/fns/overrides/console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,17 @@ class UserLog {
return {
method,
id,
data: this.sanitizeData(klona(output)),
data: this.sanitizeData(klona12(output)),
timestamp,
severity,
source: this.getSource(triggerMeta),
};
}
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const klona12 = (data: any) => {
return klona(data);
};
const userLogs = new UserLog();

export default userLogs;
9 changes: 7 additions & 2 deletions app/client/src/workers/Evaluation/fns/resetWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ async function resetWidget(
);
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const klona11 = (data: any) => {
return klona(data);
};

function resetWidgetMetaProperty(
widgetName: string,
resetChildren = true,
Expand Down Expand Up @@ -123,9 +128,9 @@ function resetWidgetMetaProperty(
configTree,
);

finalValue = klona(result);
finalValue = klona11(result);
} else {
finalValue = klona(expressionToEvaluate);
finalValue = klona11(expressionToEvaluate);
}

// Switch back to async evaluation once done with sync tasks.
Expand Down
12 changes: 11 additions & 1 deletion app/client/src/workers/Evaluation/handlers/evalExpression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import { klona } from "klona/full";
import { evaluateAsync } from "../evaluate";
import type { EvalWorkerASyncRequest } from "../types";
import { dataTreeEvaluator } from "./evalTree";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const klona13 = (data: any) => {
return klona(data);
};

export default function (request: EvalWorkerASyncRequest) {
const { data } = request;
Expand All @@ -11,5 +15,11 @@ export default function (request: EvalWorkerASyncRequest) {

if (!evalTree || !configTree) return {};

return evaluateAsync(expression, klona(evalTree), configTree, {}, undefined);
return evaluateAsync(
expression,
klona13(evalTree),
configTree,
{},
undefined,
);
}
51 changes: 41 additions & 10 deletions app/client/src/workers/common/DataTreeEvaluator/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import type {
DataTreeEvaluationProps,
EvalError as TEvalError,
Expand Down Expand Up @@ -241,6 +242,15 @@ export default class DataTreeEvaluator {
* Method to create all data required for linting and
* evaluation of the first tree
*/
klona1(data: any) {
return klona(data);
}
klona2(data: any) {
return klona(data);
}
klona3(data: any) {
return klona(data);
}
async setupFirstTree(
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand All @@ -254,7 +264,7 @@ export default class DataTreeEvaluator {
const totalFirstTreeSetupStartTime = performance.now();
// cloneDeep will make sure not to omit key which has value as undefined.
const firstCloneStartTime = performance.now();
let localUnEvalTree = klona(unEvalTree);
let localUnEvalTree = this.klona1(unEvalTree);
const firstCloneEndTime = performance.now();

let jsUpdates: Record<string, JSUpdate> = {};
Expand Down Expand Up @@ -326,7 +336,7 @@ export default class DataTreeEvaluator {

const secondCloneStartTime = performance.now();

this.oldUnEvalTree = klona(localUnEvalTree);
this.oldUnEvalTree = this.klona2(localUnEvalTree);
this.oldConfigTree = configTree;
const secondCloneEndTime = performance.now();

Expand Down Expand Up @@ -834,7 +844,7 @@ export default class DataTreeEvaluator {

// TODO: For some reason we are passing some reference which are getting mutated.
// Need to check why big api responses are getting split between two eval runs
this.oldUnEvalTree = klona(updatedUnEvalTree);
this.oldUnEvalTree = this.klona3(updatedUnEvalTree);
this.oldConfigTree = Object.assign({}, this.getConfigTree());
const cloneEndTime = performance.now();

Expand Down Expand Up @@ -1040,6 +1050,27 @@ export default class DataTreeEvaluator {
return privateWidgets;
}

klona4(data: any) {
return klona(data);
}
klona5(data: any) {
return klona(data);
}
klona6(data: any) {
return klona(data);
}
klona7(data: any) {
return klona(data);
}
klona8(data: any) {
return klona(data);
}
klona9(data: any) {
return klona(data);
}
klona15(data: any) {
return klonaJSON(data);
}
evaluateTree(
unEvalTree: DataTree,
evaluationOrder: Array<string>,
Expand All @@ -1059,9 +1090,9 @@ export default class DataTreeEvaluator {
staleMetaIds: string[];
contextTree: DataTree;
} {
const safeTree = klona(unEvalTree);
const safeTree = this.klona4(unEvalTree);
const dataStore = DataStore.getDataStore();
const dataStoreClone = klonaJSON(dataStore);
const dataStoreClone = this.klona15(dataStore);

updateTreeWithData(safeTree, dataStoreClone);
updateTreeWithData(unEvalTree, dataStore);
Expand Down Expand Up @@ -1207,7 +1238,7 @@ export default class DataTreeEvaluator {
);

set(contextTree, fullPropertyPath, parsedValue);
set(safeTree, fullPropertyPath, klona(parsedValue));
set(safeTree, fullPropertyPath, this.klona5(parsedValue));

staleMetaIds = staleMetaIds.concat(
getStaleMetaStateIds({
Expand Down Expand Up @@ -1253,7 +1284,7 @@ export default class DataTreeEvaluator {
if (!requiresEval) continue;

set(contextTree, fullPropertyPath, evalPropertyValue);
set(safeTree, fullPropertyPath, klona(evalPropertyValue));
set(safeTree, fullPropertyPath, this.klona6(evalPropertyValue));
break;
}
case ENTITY_TYPE.JSACTION: {
Expand Down Expand Up @@ -1290,7 +1321,7 @@ export default class DataTreeEvaluator {
* Their evaluated values need to be reset only when the variable is modified by the user.
* When uneval value of a js variable hasn't changed, it means that the previously evaluated values are in both trees already */
if (!skipVariableValueAssignment) {
const valueForSafeTree = klona(evalValue);
const valueForSafeTree = this.klona7(evalValue);

set(contextTree, fullPropertyPath, evalValue);
set(safeTree, fullPropertyPath, valueForSafeTree);
Expand All @@ -1305,7 +1336,7 @@ export default class DataTreeEvaluator {
}
default:
set(contextTree, fullPropertyPath, evalPropertyValue);
set(safeTree, fullPropertyPath, klona(evalPropertyValue));
set(safeTree, fullPropertyPath, this.klona8(evalPropertyValue));
}
}
} catch (error) {
Expand Down Expand Up @@ -1793,7 +1824,7 @@ export default class DataTreeEvaluator {
bindings: string[],
executionParams?: Record<string, unknown> | string,
) {
const dataTree = klona(this.evalTree);
const dataTree = this.klona9(this.evalTree);
// We might get execution params as an object or as a string.
// If the user has added a proper object (valid case) it will be an object
// If they have not added any execution params or not an object
Expand Down
Loading