diff --git a/app/client/cypress/e2e/Regression/ClientSide/Autocomplete/JS_AC1_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Autocomplete/JS_AC1_spec.ts index f8190d48f01..d37b4389a20 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Autocomplete/JS_AC1_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Autocomplete/JS_AC1_spec.ts @@ -298,7 +298,7 @@ describe("Autocomplete tests", { tags: ["@tag.JS", "@tag.Binding"] }, () => { ) .type("."); - agHelper.GetNAssertElementText(locators._hints, "geolocation"); + agHelper.GetNAssertElementText(locators._hints, "appName"); }); }); @@ -313,6 +313,6 @@ describe("Autocomplete tests", { tags: ["@tag.JS", "@tag.Binding"] }, () => { .type("{downArrow}{leftArrow}{leftArrow}"); agHelper.TypeText(locators._codeMirrorTextArea, "."); - agHelper.GetNAssertElementText(locators._hints, "geolocation"); + agHelper.GetNAssertElementText(locators._hints, "appName"); }); }); diff --git a/app/client/src/ce/entities/DataTree/types.ts b/app/client/src/ce/entities/DataTree/types.ts index a2fcbcbc9d2..42652009b95 100644 --- a/app/client/src/ce/entities/DataTree/types.ts +++ b/app/client/src/ce/entities/DataTree/types.ts @@ -190,6 +190,9 @@ export interface AppsmithEntity extends Omit { ENTITY_TYPE: typeof ENTITY_TYPE.APPSMITH; store: Record; theme: AppTheme["properties"]; + currentPageName: string; + workspaceName: string; + appName: string; } export interface DataTreeSeed { diff --git a/app/client/src/selectors/dataTreeSelectors.ts b/app/client/src/selectors/dataTreeSelectors.ts index 1babbe0563b..b64f4fbba4f 100644 --- a/app/client/src/selectors/dataTreeSelectors.ts +++ b/app/client/src/selectors/dataTreeSelectors.ts @@ -41,6 +41,9 @@ import { getCurrentWorkflowActions, getCurrentWorkflowJSActions, } from "ee/selectors/workflowSelectors"; +import { getCurrentApplication } from "ee/selectors/applicationSelectors"; +import { getCurrentAppWorkspace } from "ee/selectors/selectedWorkspaceSelectors"; +import type { PageListReduxState } from "reducers/entityReducers/pageListReducer"; export const getLoadingEntities = (state: AppState) => state.evaluations.loadingEntities; @@ -130,6 +133,15 @@ const getMetaWidgetsFromUnevaluatedDataTree = createSelector( DataTreeFactory.metaWidgets(metaWidgets, widgetsMeta, loadingEntities), ); +// * This is only for internal use to avoid cyclic dependency issue +const getPageListState = (state: AppState) => state.entities.pageList; +const getCurrentPageName = createSelector( + getPageListState, + (pageList: PageListReduxState) => + pageList.pages.find((page) => page.pageId === pageList.currentPageId) + ?.pageName, +); + export const getUnevaluatedDataTree = createSelector( getActionsFromUnevaluatedDataTree, getJSActionsFromUnevaluatedDataTree, @@ -137,7 +149,20 @@ export const getUnevaluatedDataTree = createSelector( getMetaWidgetsFromUnevaluatedDataTree, getAppData, getSelectedAppThemeProperties, - (actions, jsActions, widgets, metaWidgets, appData, theme) => { + getCurrentAppWorkspace, + getCurrentApplication, + getCurrentPageName, + ( + actions, + jsActions, + widgets, + metaWidgets, + appData, + theme, + currentWorkspace, + currentApplication, + getCurrentPageName, + ) => { let dataTree: UnEvalTree = { ...actions.dataTree, ...jsActions.dataTree, @@ -155,6 +180,9 @@ export const getUnevaluatedDataTree = createSelector( // taking precedence in case the key is the same store: appData.store, theme, + currentPageName: getCurrentPageName, + workspaceName: currentWorkspace.name, + appName: currentApplication?.name, } as AppsmithEntity; (dataTree.appsmith as AppsmithEntity).ENTITY_TYPE = ENTITY_TYPE.APPSMITH; dataTree = { ...dataTree, ...metaWidgets.dataTree };