chore: fixed typescript errors which are thrown in EE because of split (#28009)
## Description few type errors which are being thrown in ee because of the split is fixed in this PR #### Type of change - Chore (housekeeping or task changes that don't impact user perception) > > > ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [ ] Manual - [ ] JUnit - [ ] Jest - [ ] Cypress > > #### Test Plan > Add Testsmith test cases links that relate to this PR > > #### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) > > > ## Checklist: #### Dev activity - [ ] 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 - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
This commit is contained in:
parent
63a02af32d
commit
575d7fcc36
|
|
@ -626,9 +626,10 @@ describe("5. overrideWidgetProperties", () => {
|
||||||
});
|
});
|
||||||
// When default text is re-evaluated it will override values of meta.text and text in InputWidget
|
// When default text is re-evaluated it will override values of meta.text and text in InputWidget
|
||||||
it("1. defaultText updating meta.text and text", () => {
|
it("1. defaultText updating meta.text and text", () => {
|
||||||
|
const widgetEntity = currentTree.Input1 as WidgetEntity;
|
||||||
const evalMetaUpdates: EvalMetaUpdates = [];
|
const evalMetaUpdates: EvalMetaUpdates = [];
|
||||||
const overwriteObj = overrideWidgetProperties({
|
const overwriteObj = overrideWidgetProperties({
|
||||||
entity: currentTree.Input1 as WidgetEntity,
|
entity: widgetEntity,
|
||||||
propertyPath: "defaultText",
|
propertyPath: "defaultText",
|
||||||
value: "abcde",
|
value: "abcde",
|
||||||
|
|
||||||
|
|
@ -643,30 +644,28 @@ describe("5. overrideWidgetProperties", () => {
|
||||||
|
|
||||||
expect(evalMetaUpdates).toStrictEqual([
|
expect(evalMetaUpdates).toStrictEqual([
|
||||||
{
|
{
|
||||||
//@ts-expect-error: widgetId does not exits on type DataTreeEntity
|
widgetId: widgetEntity.widgetId,
|
||||||
widgetId: currentTree.Input1.widgetId,
|
|
||||||
metaPropertyPath: ["inputText"],
|
metaPropertyPath: ["inputText"],
|
||||||
value: "abcde",
|
value: "abcde",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//@ts-expect-error: widgetId does not exits on type DataTreeEntity
|
widgetId: widgetEntity.widgetId,
|
||||||
widgetId: currentTree.Input1.widgetId,
|
|
||||||
metaPropertyPath: ["text"],
|
metaPropertyPath: ["text"],
|
||||||
value: "abcde",
|
value: "abcde",
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//@ts-expect-error: meta does not exits on type DataTreeEntity
|
expect(widgetEntity.meta).toStrictEqual({
|
||||||
expect(currentTree.Input1.meta).toStrictEqual({
|
|
||||||
text: "abcde",
|
text: "abcde",
|
||||||
inputText: "abcde",
|
inputText: "abcde",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// When meta.text is re-evaluated it will override values text in InputWidget
|
// When meta.text is re-evaluated it will override values text in InputWidget
|
||||||
it("2. meta.text updating text", () => {
|
it("2. meta.text updating text", () => {
|
||||||
|
const widgetEntity = currentTree.Input1 as WidgetEntity;
|
||||||
const evalMetaUpdates: EvalMetaUpdates = [];
|
const evalMetaUpdates: EvalMetaUpdates = [];
|
||||||
const overwriteObj = overrideWidgetProperties({
|
const overwriteObj = overrideWidgetProperties({
|
||||||
entity: currentTree.Input1 as WidgetEntity,
|
entity: widgetEntity,
|
||||||
propertyPath: "meta.text",
|
propertyPath: "meta.text",
|
||||||
value: "abcdefg",
|
value: "abcdefg",
|
||||||
currentTree,
|
currentTree,
|
||||||
|
|
@ -680,8 +679,7 @@ describe("5. overrideWidgetProperties", () => {
|
||||||
|
|
||||||
expect(evalMetaUpdates).toStrictEqual([]);
|
expect(evalMetaUpdates).toStrictEqual([]);
|
||||||
|
|
||||||
//@ts-expect-error: text does not exits on type DataTreeEntity
|
expect(widgetEntity.text).toStrictEqual("abcdefg");
|
||||||
expect(currentTree.Input1.text).toStrictEqual("abcdefg");
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -713,9 +711,10 @@ describe("5. overrideWidgetProperties", () => {
|
||||||
});
|
});
|
||||||
// When default defaultSelectedRow is re-evaluated it will override values of meta.selectedRowIndices, selectedRowIndices, meta.selectedRowIndex & selectedRowIndex.
|
// When default defaultSelectedRow is re-evaluated it will override values of meta.selectedRowIndices, selectedRowIndices, meta.selectedRowIndex & selectedRowIndex.
|
||||||
it("1. On change of defaultSelectedRow ", () => {
|
it("1. On change of defaultSelectedRow ", () => {
|
||||||
|
const widgetEntity = currentTree.Table1 as WidgetEntity;
|
||||||
const evalMetaUpdates: EvalMetaUpdates = [];
|
const evalMetaUpdates: EvalMetaUpdates = [];
|
||||||
const overwriteObj = overrideWidgetProperties({
|
const overwriteObj = overrideWidgetProperties({
|
||||||
entity: currentTree.Table1 as WidgetEntity,
|
entity: widgetEntity,
|
||||||
propertyPath: "defaultSelectedRow",
|
propertyPath: "defaultSelectedRow",
|
||||||
value: [0, 1],
|
value: [0, 1],
|
||||||
currentTree,
|
currentTree,
|
||||||
|
|
@ -729,29 +728,27 @@ describe("5. overrideWidgetProperties", () => {
|
||||||
|
|
||||||
expect(evalMetaUpdates).toStrictEqual([
|
expect(evalMetaUpdates).toStrictEqual([
|
||||||
{
|
{
|
||||||
//@ts-expect-error: widgetId does not exits on type DataTreeEntity
|
widgetId: widgetEntity.widgetId,
|
||||||
widgetId: currentTree.Table1.widgetId,
|
|
||||||
metaPropertyPath: ["selectedRowIndex"],
|
metaPropertyPath: ["selectedRowIndex"],
|
||||||
value: [0, 1],
|
value: [0, 1],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
//@ts-expect-error: widgetId does not exits on type DataTreeEntity
|
widgetId: widgetEntity.widgetId,
|
||||||
widgetId: currentTree.Table1.widgetId,
|
|
||||||
metaPropertyPath: ["selectedRowIndices"],
|
metaPropertyPath: ["selectedRowIndices"],
|
||||||
value: [0, 1],
|
value: [0, 1],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//@ts-expect-error: meta does not exits on type DataTreeEntity
|
expect(widgetEntity.meta.selectedRowIndex).toStrictEqual([0, 1]);
|
||||||
expect(currentTree.Table1.meta.selectedRowIndex).toStrictEqual([0, 1]);
|
|
||||||
//@ts-expect-error: meta does not exits on type DataTreeEntity
|
expect(widgetEntity.meta.selectedRowIndices).toStrictEqual([0, 1]);
|
||||||
expect(currentTree.Table1.meta.selectedRowIndices).toStrictEqual([0, 1]);
|
|
||||||
});
|
});
|
||||||
// When meta.selectedRowIndex is re-evaluated it will override values selectedRowIndex
|
// When meta.selectedRowIndex is re-evaluated it will override values selectedRowIndex
|
||||||
it("2. meta.selectedRowIndex updating selectedRowIndex", () => {
|
it("2. meta.selectedRowIndex updating selectedRowIndex", () => {
|
||||||
|
const widgetEntity = currentTree.Table1 as WidgetEntity;
|
||||||
const evalMetaUpdates: EvalMetaUpdates = [];
|
const evalMetaUpdates: EvalMetaUpdates = [];
|
||||||
const overwriteObj = overrideWidgetProperties({
|
const overwriteObj = overrideWidgetProperties({
|
||||||
entity: currentTree.Table1 as WidgetEntity,
|
entity: widgetEntity,
|
||||||
propertyPath: "meta.selectedRowIndex",
|
propertyPath: "meta.selectedRowIndex",
|
||||||
value: 0,
|
value: 0,
|
||||||
currentTree,
|
currentTree,
|
||||||
|
|
@ -765,8 +762,7 @@ describe("5. overrideWidgetProperties", () => {
|
||||||
|
|
||||||
expect(evalMetaUpdates).toStrictEqual([]);
|
expect(evalMetaUpdates).toStrictEqual([]);
|
||||||
|
|
||||||
//@ts-expect-error: selectedRowIndex does not exits on type DataTreeEntity
|
expect(widgetEntity.selectedRowIndex).toStrictEqual(0);
|
||||||
expect(currentTree.Table1.selectedRowIndex).toStrictEqual(0);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -737,7 +737,9 @@ const getDataTreeWithoutSuppressedAutoComplete = (
|
||||||
): DataTree => {
|
): DataTree => {
|
||||||
const entityIds = Object.keys(dataTree).filter((entityName) => {
|
const entityIds = Object.keys(dataTree).filter((entityName) => {
|
||||||
const entity = dataTree[entityName];
|
const entity = dataTree[entityName];
|
||||||
return isWidget(entity) && shouldSuppressAutoComplete(entity);
|
return (
|
||||||
|
isWidget(entity) && shouldSuppressAutoComplete(entity as WidgetEntity)
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
return _.omit(dataTree, entityIds);
|
return _.omit(dataTree, entityIds);
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import history, { NavigationMethod } from "utils/history";
|
||||||
import { jsCollectionIdURL } from "@appsmith/RouteBuilder";
|
import { jsCollectionIdURL } from "@appsmith/RouteBuilder";
|
||||||
import store from "store";
|
import store from "store";
|
||||||
import { PluginType } from "entities/Action";
|
import { PluginType } from "entities/Action";
|
||||||
|
import type { WidgetEntity } from "@appsmith/entities/DataTree/types";
|
||||||
|
|
||||||
export const useFilteredLogs = (query: string, filter?: any) => {
|
export const useFilteredLogs = (query: string, filter?: any) => {
|
||||||
let logs = useSelector((state: AppState) => state.ui.debugger.logs);
|
let logs = useSelector((state: AppState) => state.ui.debugger.logs);
|
||||||
|
|
@ -141,8 +142,9 @@ export const useEntityLink = () => {
|
||||||
const entityConfig = configTree[name];
|
const entityConfig = configTree[name];
|
||||||
if (!pageId) return;
|
if (!pageId) return;
|
||||||
if (isWidget(entity)) {
|
if (isWidget(entity)) {
|
||||||
|
const widgetEntity = entity as WidgetEntity;
|
||||||
navigateToWidget(
|
navigateToWidget(
|
||||||
entity.widgetId,
|
widgetEntity.widgetId,
|
||||||
entity.type,
|
entity.type,
|
||||||
pageId || "",
|
pageId || "",
|
||||||
NavigationMethod.Debugger,
|
NavigationMethod.Debugger,
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import {
|
||||||
import { doesEntityHaveErrors } from "../helpers";
|
import { doesEntityHaveErrors } from "../helpers";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import WidgetIcon from "pages/Editor/Explorer/Widgets/WidgetIcon";
|
import WidgetIcon from "pages/Editor/Explorer/Widgets/WidgetIcon";
|
||||||
|
import type { WidgetEntity } from "@appsmith/entities/DataTree/types";
|
||||||
|
|
||||||
export const useGetEntityInfo = (name: string) => {
|
export const useGetEntityInfo = (name: string) => {
|
||||||
const entity = useSelector((state: AppState) => state.evaluations.tree[name]);
|
const entity = useSelector((state: AppState) => state.evaluations.tree[name]);
|
||||||
|
|
@ -36,15 +37,19 @@ export const useGetEntityInfo = (name: string) => {
|
||||||
|
|
||||||
const getEntityInfo = useCallback(() => {
|
const getEntityInfo = useCallback(() => {
|
||||||
if (isWidget(entity)) {
|
if (isWidget(entity)) {
|
||||||
|
const widgetEntity = entity as WidgetEntity;
|
||||||
const icon = <WidgetIcon type={entity.type} />;
|
const icon = <WidgetIcon type={entity.type} />;
|
||||||
const hasError = doesEntityHaveErrors(entity.widgetId, debuggerErrors);
|
const hasError = doesEntityHaveErrors(
|
||||||
|
widgetEntity.widgetId,
|
||||||
|
debuggerErrors,
|
||||||
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name,
|
name,
|
||||||
icon,
|
icon,
|
||||||
hasError,
|
hasError,
|
||||||
type: ENTITY_TYPE.WIDGET,
|
type: ENTITY_TYPE.WIDGET,
|
||||||
entityType: entity.type,
|
entityType: widgetEntity.type,
|
||||||
};
|
};
|
||||||
} else if (isAction(entity)) {
|
} else if (isAction(entity)) {
|
||||||
const hasError = doesEntityHaveErrors(entity.actionId, debuggerErrors);
|
const hasError = doesEntityHaveErrors(entity.actionId, debuggerErrors);
|
||||||
|
|
|
||||||
|
|
@ -49,31 +49,33 @@ export default class EntityFactory {
|
||||||
T extends DataTreeEntity,
|
T extends DataTreeEntity,
|
||||||
K extends DataTreeEntityConfig | undefined,
|
K extends DataTreeEntityConfig | undefined,
|
||||||
>(entity: T, config: K, classLoader: EntityClassLoader): IEntity {
|
>(entity: T, config: K, classLoader: EntityClassLoader): IEntity {
|
||||||
const { DiffGenerator, Parser } = classLoader.load(entity);
|
const { DiffGenerator, Parser } = classLoader.load(
|
||||||
|
entity as DataTreeEntity,
|
||||||
|
);
|
||||||
if (isWidget(entity)) {
|
if (isWidget(entity)) {
|
||||||
return new WidgetEntity(
|
return new WidgetEntity(
|
||||||
entity,
|
entity as TWidgetEntity,
|
||||||
config as TWidgetEntityConfig,
|
config as TWidgetEntityConfig,
|
||||||
new Parser(),
|
new Parser(),
|
||||||
new DiffGenerator(),
|
new DiffGenerator(),
|
||||||
);
|
);
|
||||||
} else if (isJSAction(entity)) {
|
} else if (isJSAction(entity)) {
|
||||||
return new JSEntity(
|
return new JSEntity(
|
||||||
entity,
|
entity as TJSActionEntity,
|
||||||
config as TJSActionEntityConfig,
|
config as TJSActionEntityConfig,
|
||||||
new Parser(),
|
new Parser(),
|
||||||
new DiffGenerator(),
|
new DiffGenerator(),
|
||||||
);
|
);
|
||||||
} else if (isAction(entity)) {
|
} else if (isAction(entity)) {
|
||||||
return new ActionEntity(
|
return new ActionEntity(
|
||||||
entity,
|
entity as TActionEntity,
|
||||||
config as TActionEntityConfig,
|
config as TActionEntityConfig,
|
||||||
new Parser(),
|
new Parser(),
|
||||||
new DiffGenerator(),
|
new DiffGenerator(),
|
||||||
);
|
);
|
||||||
} else if (isAppsmith(entity)) {
|
} else if (isAppsmith(entity)) {
|
||||||
return new AppsmithEntity(
|
return new AppsmithEntity(
|
||||||
entity,
|
entity as TAppsmithEntity,
|
||||||
undefined,
|
undefined,
|
||||||
new Parser(),
|
new Parser(),
|
||||||
new DiffGenerator(),
|
new DiffGenerator(),
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,10 @@ import { getType, Types } from "utils/TypeHelpers";
|
||||||
import type { FlattenedWidgetProps } from "WidgetProvider/constants";
|
import type { FlattenedWidgetProps } from "WidgetProvider/constants";
|
||||||
import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
|
import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
|
||||||
import { getDataTree, getConfigTree } from "selectors/dataTreeSelectors";
|
import { getDataTree, getConfigTree } from "selectors/dataTreeSelectors";
|
||||||
import type { WidgetEntityConfig } from "@appsmith/entities/DataTree/types";
|
import type {
|
||||||
|
WidgetEntity,
|
||||||
|
WidgetEntityConfig,
|
||||||
|
} from "@appsmith/entities/DataTree/types";
|
||||||
import type { DataTree, ConfigTree } from "entities/DataTree/dataTreeTypes";
|
import type { DataTree, ConfigTree } from "entities/DataTree/dataTreeTypes";
|
||||||
import { isWidget } from "@appsmith/workers/Evaluation/evaluationUtils";
|
import { isWidget } from "@appsmith/workers/Evaluation/evaluationUtils";
|
||||||
import type { TResetWidgetDescription } from "workers/Evaluation/fns/resetWidget";
|
import type { TResetWidgetDescription } from "workers/Evaluation/fns/resetWidget";
|
||||||
|
|
@ -47,7 +50,7 @@ export default function* resetWidgetActionSaga(
|
||||||
yield put(
|
yield put(
|
||||||
resetWidgetMetaProperty(
|
resetWidgetMetaProperty(
|
||||||
widget.widgetId,
|
widget.widgetId,
|
||||||
evaluatedEntity,
|
evaluatedEntity as WidgetEntity,
|
||||||
evaluatedEntityConfig as WidgetEntityConfig,
|
evaluatedEntityConfig as WidgetEntityConfig,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,10 @@ import {
|
||||||
isWidget,
|
isWidget,
|
||||||
} from "@appsmith/workers/Evaluation/evaluationUtils";
|
} from "@appsmith/workers/Evaluation/evaluationUtils";
|
||||||
import { getCurrentEnvironmentDetails } from "@appsmith/selectors/environmentSelectors";
|
import { getCurrentEnvironmentDetails } from "@appsmith/selectors/environmentSelectors";
|
||||||
|
import type {
|
||||||
|
ActionEntity,
|
||||||
|
WidgetEntity,
|
||||||
|
} from "@appsmith/entities/DataTree/types";
|
||||||
import { getActiveEditorField } from "selectors/activeEditorFieldSelectors";
|
import { getActiveEditorField } from "selectors/activeEditorFieldSelectors";
|
||||||
|
|
||||||
let blockedSource: string | null = null;
|
let blockedSource: string | null = null;
|
||||||
|
|
@ -186,23 +190,25 @@ function getLogsFromDependencyChain(
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isAction(entity)) {
|
if (isAction(entity)) {
|
||||||
|
const actionEntity = entity as ActionEntity;
|
||||||
log = {
|
log = {
|
||||||
...log,
|
...log,
|
||||||
text: createMessage(ACTION_CONFIGURATION_UPDATED),
|
text: createMessage(ACTION_CONFIGURATION_UPDATED),
|
||||||
source: {
|
source: {
|
||||||
type: ENTITY_TYPE.ACTION,
|
type: ENTITY_TYPE.ACTION,
|
||||||
name: entityInfo.entityName,
|
name: entityInfo.entityName,
|
||||||
id: entity.actionId,
|
id: actionEntity.actionId,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
} else if (isWidget(entity)) {
|
} else if (isWidget(entity)) {
|
||||||
|
const widgetEntity = entity as WidgetEntity;
|
||||||
log = {
|
log = {
|
||||||
...log,
|
...log,
|
||||||
text: createMessage(WIDGET_PROPERTIES_UPDATED),
|
text: createMessage(WIDGET_PROPERTIES_UPDATED),
|
||||||
source: {
|
source: {
|
||||||
type: ENTITY_TYPE.WIDGET,
|
type: ENTITY_TYPE.WIDGET,
|
||||||
name: entityInfo.entityName,
|
name: entityInfo.entityName,
|
||||||
id: entity.widgetId,
|
id: widgetEntity.widgetId,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,12 @@ import {
|
||||||
PLATFORM_ERROR,
|
PLATFORM_ERROR,
|
||||||
Severity,
|
Severity,
|
||||||
} from "entities/AppsmithConsole";
|
} from "entities/AppsmithConsole";
|
||||||
import type { WidgetEntityConfig } from "@appsmith/entities/DataTree/types";
|
import type {
|
||||||
|
ActionEntity,
|
||||||
|
JSActionEntity,
|
||||||
|
WidgetEntity,
|
||||||
|
WidgetEntityConfig,
|
||||||
|
} from "@appsmith/entities/DataTree/types";
|
||||||
import type {
|
import type {
|
||||||
ConfigTree,
|
ConfigTree,
|
||||||
DataTree,
|
DataTree,
|
||||||
|
|
@ -75,7 +80,10 @@ function logLatestEvalPropertyErrors(
|
||||||
for (const evaluatedPath of evalAndValidationOrder) {
|
for (const evaluatedPath of evalAndValidationOrder) {
|
||||||
const { entityName, propertyPath } =
|
const { entityName, propertyPath } =
|
||||||
getEntityNameAndPropertyPath(evaluatedPath);
|
getEntityNameAndPropertyPath(evaluatedPath);
|
||||||
const entity = dataTree[entityName];
|
const entity = dataTree[entityName] as
|
||||||
|
| WidgetEntity
|
||||||
|
| ActionEntity
|
||||||
|
| JSActionEntity;
|
||||||
const entityConfig = configTree[entityName] as any;
|
const entityConfig = configTree[entityName] as any;
|
||||||
|
|
||||||
if (isWidget(entity) || isAction(entity) || isJSAction(entity)) {
|
if (isWidget(entity) || isAction(entity) || isJSAction(entity)) {
|
||||||
|
|
@ -490,7 +498,10 @@ export function* updateTernDefinitions(
|
||||||
);
|
);
|
||||||
const entity = dataTree[entityName];
|
const entity = dataTree[entityName];
|
||||||
if (!entity || !isWidget(entity)) return false;
|
if (!entity || !isWidget(entity)) return false;
|
||||||
return isWidgetPropertyNamePath(entity, update.payload.propertyPath);
|
return isWidgetPropertyNamePath(
|
||||||
|
entity as WidgetEntity,
|
||||||
|
update.payload.propertyPath,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!shouldUpdate) return;
|
if (!shouldUpdate) return;
|
||||||
|
|
|
||||||
|
|
@ -46,22 +46,24 @@ export const getFilteredErrors = createSelector(
|
||||||
// filter error - when widget or parent widget is hidden
|
// filter error - when widget or parent widget is hidden
|
||||||
// parent widgets e.g. modal, tab, container
|
// parent widgets e.g. modal, tab, container
|
||||||
if (entity && isWidget(entity)) {
|
if (entity && isWidget(entity)) {
|
||||||
if (shouldSuppressDebuggerError(entity)) {
|
const widgetEntity = entity as WidgetEntity;
|
||||||
|
if (shouldSuppressDebuggerError(widgetEntity)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!hasParentWidget(entity)) {
|
if (!hasParentWidget(widgetEntity)) {
|
||||||
return entity.isVisible
|
return widgetEntity.isVisible
|
||||||
? true
|
? true
|
||||||
: alwaysShowEntities[entity.widgetId];
|
: alwaysShowEntities[widgetEntity.widgetId];
|
||||||
} else {
|
} else {
|
||||||
const isParentWidgetVisible = isParentVisible(
|
const isParentWidgetVisible = isParentVisible(
|
||||||
entity,
|
widgetEntity,
|
||||||
canvasWidgets,
|
canvasWidgets,
|
||||||
dataTree,
|
dataTree,
|
||||||
);
|
);
|
||||||
return entity.isVisible
|
return widgetEntity.isVisible
|
||||||
? isParentWidgetVisible
|
? isParentWidgetVisible
|
||||||
: isParentWidgetVisible && alwaysShowEntities[entity.widgetId];
|
: isParentWidgetVisible &&
|
||||||
|
alwaysShowEntities[widgetEntity.widgetId];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import type {
|
import type {
|
||||||
WidgetEntityConfig,
|
WidgetEntityConfig,
|
||||||
JSActionEntityConfig,
|
JSActionEntityConfig,
|
||||||
|
WidgetEntity,
|
||||||
} from "@appsmith/entities/DataTree/types";
|
} from "@appsmith/entities/DataTree/types";
|
||||||
import type {
|
import type {
|
||||||
ConfigTree,
|
ConfigTree,
|
||||||
|
|
@ -57,7 +58,7 @@ export const dataTreeTypeDefCreator = (
|
||||||
|
|
||||||
if (isFunction(autocompleteDefinitions)) {
|
if (isFunction(autocompleteDefinitions)) {
|
||||||
def[entityName] = autocompleteDefinitions(
|
def[entityName] = autocompleteDefinitions(
|
||||||
entity,
|
entity as WidgetEntity,
|
||||||
extraDefsToDefine,
|
extraDefsToDefine,
|
||||||
entityConfig,
|
entityConfig,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -119,10 +119,11 @@ export const entityFns = [
|
||||||
name: "run",
|
name: "run",
|
||||||
qualifier: (entity: DataTreeEntity) => isAction(entity),
|
qualifier: (entity: DataTreeEntity) => isAction(entity),
|
||||||
fn: (entity: DataTreeEntity, entityName: string) => {
|
fn: (entity: DataTreeEntity, entityName: string) => {
|
||||||
|
const actionEntity = entity as ActionEntity;
|
||||||
// @ts-expect-error: name is not defined on ActionEntity
|
// @ts-expect-error: name is not defined on ActionEntity
|
||||||
entity.name = entityName;
|
actionEntity.name = entityName;
|
||||||
return getFnWithGuards(
|
return getFnWithGuards(
|
||||||
run.bind(entity as ActionEntity),
|
run.bind(actionEntity as ActionEntity),
|
||||||
`${entityName}.run`,
|
`${entityName}.run`,
|
||||||
[isAsyncGuard],
|
[isAsyncGuard],
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ export function getEntityForEvalContext(
|
||||||
switch (entity.ENTITY_TYPE) {
|
switch (entity.ENTITY_TYPE) {
|
||||||
case ENTITY_TYPE_VALUE.JSACTION: {
|
case ENTITY_TYPE_VALUE.JSACTION: {
|
||||||
const jsObjectName = entityName;
|
const jsObjectName = entityName;
|
||||||
const jsObject = entity;
|
const jsObject = entity as JSActionEntity;
|
||||||
|
|
||||||
let jsObjectForEval = JSObjectCollection.getVariableState(entityName);
|
let jsObjectForEval = JSObjectCollection.getVariableState(entityName);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,10 @@ import { evalTreeWithChanges } from "./evalTreeWithChanges";
|
||||||
import { dataTreeEvaluator } from "./handlers/evalTree";
|
import { dataTreeEvaluator } from "./handlers/evalTree";
|
||||||
import { get, set } from "lodash";
|
import { get, set } from "lodash";
|
||||||
import { validate } from "./validations";
|
import { validate } from "./validations";
|
||||||
import type { DataTreeEntityConfig } from "@appsmith/entities/DataTree/types";
|
import type {
|
||||||
|
DataTreeEntityConfig,
|
||||||
|
WidgetEntity,
|
||||||
|
} from "@appsmith/entities/DataTree/types";
|
||||||
import type {
|
import type {
|
||||||
ConfigTree,
|
ConfigTree,
|
||||||
DataTree,
|
DataTree,
|
||||||
|
|
@ -89,7 +92,7 @@ class Setters {
|
||||||
|
|
||||||
if (isWidget(entity)) {
|
if (isWidget(entity)) {
|
||||||
overrideWidgetProperties({
|
overrideWidgetProperties({
|
||||||
entity,
|
entity: entity as WidgetEntity,
|
||||||
propertyPath,
|
propertyPath,
|
||||||
value: parsedValue,
|
value: parsedValue,
|
||||||
currentTree: evalTree,
|
currentTree: evalTree,
|
||||||
|
|
|
||||||
|
|
@ -1046,9 +1046,7 @@ export default class DataTreeEvaluator {
|
||||||
);
|
);
|
||||||
|
|
||||||
const entityType = entityConfig.ENTITY_TYPE;
|
const entityType = entityConfig.ENTITY_TYPE;
|
||||||
|
|
||||||
if (!propertyPath) continue;
|
if (!propertyPath) continue;
|
||||||
|
|
||||||
switch (entityType) {
|
switch (entityType) {
|
||||||
case ENTITY_TYPE_VALUE.WIDGET: {
|
case ENTITY_TYPE_VALUE.WIDGET: {
|
||||||
if (isATriggerPath) continue;
|
if (isATriggerPath) continue;
|
||||||
|
|
@ -1278,7 +1276,7 @@ export default class DataTreeEvaluator {
|
||||||
const node = result.cyclicNode;
|
const node = result.cyclicNode;
|
||||||
let entityType = "UNKNOWN";
|
let entityType = "UNKNOWN";
|
||||||
const entityName = node.split(".")[0];
|
const entityName = node.split(".")[0];
|
||||||
const entity = get(this.oldUnEvalTree, entityName);
|
const entity = get(this.oldUnEvalTree, entityName) as DataTreeEntity;
|
||||||
const entityConfig = get(this.oldConfigTree, entityName);
|
const entityConfig = get(this.oldConfigTree, entityName);
|
||||||
if (entity && isWidget(entity)) {
|
if (entity && isWidget(entity)) {
|
||||||
entityType = entity.type;
|
entityType = entity.type;
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import { replaceThisDotParams } from "./utils";
|
||||||
import { isDataField } from "./utils";
|
import { isDataField } from "./utils";
|
||||||
import widgets from "widgets";
|
import widgets from "widgets";
|
||||||
import type { WidgetConfiguration } from "WidgetProvider/constants";
|
import type { WidgetConfiguration } from "WidgetProvider/constants";
|
||||||
|
import type { WidgetEntity } from "@appsmith/entities/DataTree/types";
|
||||||
|
|
||||||
const widgetConfigMap: Record<
|
const widgetConfigMap: Record<
|
||||||
string,
|
string,
|
||||||
|
|
@ -179,10 +180,11 @@ describe("DataTreeEvaluator", () => {
|
||||||
event: "EDIT",
|
event: "EDIT",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
const button2 = dataTreeEvaluator.oldUnEvalTree.Button2 as WidgetEntity;
|
||||||
const newUnevalTree = {
|
const newUnevalTree = {
|
||||||
...dataTreeEvaluator.oldUnEvalTree,
|
...dataTreeEvaluator.oldUnEvalTree,
|
||||||
Button2: {
|
Button2: {
|
||||||
...dataTreeEvaluator.oldUnEvalTree.Button2,
|
...button2,
|
||||||
text: '{{""}}',
|
text: '{{""}}',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
@ -210,10 +212,11 @@ describe("DataTreeEvaluator", () => {
|
||||||
event: "EDIT",
|
event: "EDIT",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
const button2 = dataTreeEvaluator.oldUnEvalTree.Button2 as WidgetEntity;
|
||||||
const newUnevalTree = {
|
const newUnevalTree = {
|
||||||
...dataTreeEvaluator.oldUnEvalTree,
|
...dataTreeEvaluator.oldUnEvalTree,
|
||||||
Button2: {
|
Button2: {
|
||||||
...dataTreeEvaluator.oldUnEvalTree.Button2,
|
...button2,
|
||||||
text: "abc",
|
text: "abc",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user