From 435897e5e5783b87f2fedb3b622b600ab2062177 Mon Sep 17 00:00:00 2001 From: Ilia Date: Thu, 20 Mar 2025 09:02:24 +0100 Subject: [PATCH] feat: filter fc by page (#39818) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Fixes #39765 ## Automation /ok-to-test tags="@tag.AIAgents" ### :mag: Cypress test results > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: 59a83270789e981f5cf7aeea58de5a98191b55ee > Cypress dashboard. > Tags: `@tag.AIAgents` > Spec: >
Thu, 20 Mar 2025 07:49:32 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No ## Summary by CodeRabbit - **New Features** - Improved the filtering of available actions so that only those relevant to the current page are displayed, streamlining configuration and reducing interface clutter. --- .../components/selectors.ts | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/app/client/src/components/formControls/FunctionCallingConfigControl/components/selectors.ts b/app/client/src/components/formControls/FunctionCallingConfigControl/components/selectors.ts index bda16496c3..489ef1cadf 100644 --- a/app/client/src/components/formControls/FunctionCallingConfigControl/components/selectors.ts +++ b/app/client/src/components/formControls/FunctionCallingConfigControl/components/selectors.ts @@ -5,6 +5,7 @@ import { getPlugins, } from "ee/selectors/entitiesSelector"; import { createSelector } from "reselect"; +import { getCurrentPageId } from "selectors/editorSelectors"; import type { FunctionCallingEntityType, FunctionCallingEntityTypeOption, @@ -14,6 +15,7 @@ export const selectQueryEntityOptions = ( state: AppState, ): FunctionCallingEntityTypeOption[] => { const plugins = getPlugins(state); + const currentPageId = getCurrentPageId(state); return ( getActions(state) @@ -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, @@ -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", + }; + }); }); };