diff --git a/app/client/src/pages/Templates/Filters.tsx b/app/client/src/pages/Templates/Filters.tsx index 34f2c76474..219e04d6cc 100644 --- a/app/client/src/pages/Templates/Filters.tsx +++ b/app/client/src/pages/Templates/Filters.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useMemo } from "react"; import styled from "styled-components"; import { useDispatch, useSelector } from "react-redux"; import { Checkbox, Text } from "design-system"; @@ -110,6 +110,12 @@ function FilterCategory({ label, selectedFilters, }: FilterCategoryProps) { + const filterLabelsToDisplay: Record = useMemo( + () => ({ + functions: "teams", + }), + [], + ); // const [expand, setExpand] = useState(!!selectedFilters.length); const dispatch = useDispatch(); // This indicates how many filter items do we want to show, the rest are hidden @@ -139,7 +145,7 @@ function FilterCategory({ return ( - {`${label} `} + {`${filterLabelsToDisplay[label] ?? label} `} {!!selectedFilters.length && `(${selectedFilters.length})`} diff --git a/app/client/src/selectors/templatesSelectors.tsx b/app/client/src/selectors/templatesSelectors.tsx index 3b8c12f881..3ad518c020 100644 --- a/app/client/src/selectors/templatesSelectors.tsx +++ b/app/client/src/selectors/templatesSelectors.tsx @@ -3,7 +3,6 @@ import Fuse from "fuse.js"; import type { AppState } from "@appsmith/reducers"; import { createSelector } from "reselect"; import { getWorkspaceCreateApplication } from "@appsmith/selectors/applicationSelectors"; -import { getWidgetCards } from "./editorSelectors"; import { getDefaultPlugins } from "./entitiesSelector"; import type { Filter } from "pages/Templates/Filters"; @@ -149,14 +148,12 @@ export const templatesFiltersSelector = (state: AppState) => // Get all filters which is associated with atleast one template // If no template is associated with a filter, then the filter shouldn't be in the filter list export const getFilterListSelector = createSelector( - getWidgetCards, - templatesDatasourceFiltersSelector, getTemplatesSelector, templatesFiltersSelector, - (widgetConfigs, allDatasources, templates, allTemplateFilters) => { + (templates, allTemplateFilters) => { + const FUNCTIONS_FILTER = "functions"; const filters: Record = { - datasources: [], - functions: [], + [FUNCTIONS_FILTER]: [], }; const allFunctions = allTemplateFilters.functions.map((item) => { @@ -191,11 +188,9 @@ export const getFilterListSelector = createSelector( }); }; - templates.map((template) => { - filterFilters("datasources", allDatasources, template); - filterFilters("functions", allFunctions, template); + templates.forEach((template) => { + filterFilters(FUNCTIONS_FILTER, allFunctions, template); }); - return filters; }, );