Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
getPlugins,
} from "ee/selectors/entitiesSelector";
import { createSelector } from "reselect";
import { getCurrentPageId } from "selectors/editorSelectors";
import type {
FunctionCallingEntityType,
FunctionCallingEntityTypeOption,
Expand All @@ -14,6 +15,7 @@ export const selectQueryEntityOptions = (
state: AppState,
): FunctionCallingEntityTypeOption[] => {
const plugins = getPlugins(state);
const currentPageId = getCurrentPageId(state);

return (
getActions(state)
Expand All @@ -24,6 +26,7 @@ export const selectQueryEntityOptions = (
// @ts-expect-error No way to narrow down proper type
action.config.pluginName !== "Appsmith AI",
)
.filter((action) => action.config.pageId === currentPageId)
.map(({ config }) => ({
id: config.id,
name: config.name,
Expand All @@ -47,14 +50,18 @@ export const selectQueryEntityOptions = (
const selectJsFunctionEntityOptions = (
state: AppState,
): FunctionCallingEntityTypeOption[] => {
const currentPageId = getCurrentPageId(state);

return getJSCollections(state).flatMap((jsCollection) => {
return jsCollection.config.actions.map((jsFunction) => {
return {
value: jsFunction.id,
label: jsFunction.name,
optionGroupType: "JSFunction",
};
});
return jsCollection.config.actions
.filter((action) => action.pageId === currentPageId)
.map((jsFunction) => {
return {
value: jsFunction.id,
label: jsFunction.name,
optionGroupType: "JSFunction",
};
});
});
};

Expand Down
Loading