Skip to content
Merged
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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Consider adding test coverage for the new filtering.

Ensure there are tests covering various scenarios of the new page filtering functionality, including what happens when no page is currently selected.

Also applies to: 53-53


🏁 Script executed:

#!/bin/bash
# Find tests that might be related to these selectors to check for coverage

# Search for test files that mention these selectors
echo "Searching for tests related to these selectors..."
rg -l "selectQueryEntityOptions|selectJsFunctionEntityOptions|selectEntityOptions" --glob "*.test.*" --glob "*.spec.*"

# Check if there are tests for getCurrentPageId
echo "Checking for tests of getCurrentPageId..."
rg -l "getCurrentPageId" --glob "*.test.*" --glob "*.spec.*"

Length of output: 428


Action Required: Expand Test Coverage for New Filtering Functionality

  • While we found a test for getCurrentPageId in app/client/src/sagas/EvaluationsSaga.test.ts, the current tests do not appear to validate the new page filtering behavior.
  • Please add unit tests that explicitly cover:
    • The scenario where a page is correctly selected.
    • The scenario where no page is currently selected.
  • This additional coverage should be applied both at line 18 and line 53 in app/client/src/components/formControls/FunctionCallingConfigControl/components/selectors.ts.


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