diff --git a/app/client/cypress/e2e/Regression/ClientSide/Templates/Filtering/TemplatesModal_filtering_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Templates/Filtering/TemplatesModal_filtering_spec.ts index 41162ac0a4..99be764730 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Templates/Filtering/TemplatesModal_filtering_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Templates/Filtering/TemplatesModal_filtering_spec.ts @@ -12,6 +12,7 @@ describe("excludeForAirgap", "Bug 17276 - Templates modal filtering", () => { agHelper.GetText(templates.locators._resultsHeader).then((headerText) => { templates.FilterTemplatesByName(NAME_FILTER); + agHelper.Sleep(); if (typeof headerText === "string") { templates.AssertResultsHeaderText(headerText, "not.have.text"); } diff --git a/app/client/cypress/e2e/Regression/ClientSide/Templates/Filtering/TemplatesPage_filtering_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Templates/Filtering/TemplatesPage_filtering_spec.ts index 1e788b943e..fd73106449 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Templates/Filtering/TemplatesPage_filtering_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Templates/Filtering/TemplatesPage_filtering_spec.ts @@ -38,7 +38,6 @@ describe("excludeForAirgap", "Templates page filtering", () => { .GetText(templates.locators._resultsHeader, "text") .then((headerText) => { templates.FilterTemplatesByName(NAME_FILTER); - agHelper.Sleep(); agHelper.GetNClick(templates.locators._templateCard); agHelper.GetNClick(templates.locators._templateViewGoBack); agHelper.AssertText( diff --git a/app/client/cypress/support/Pages/Templates.ts b/app/client/cypress/support/Pages/Templates.ts index ff44208ff2..aa5b958063 100644 --- a/app/client/cypress/support/Pages/Templates.ts +++ b/app/client/cypress/support/Pages/Templates.ts @@ -17,10 +17,11 @@ export class Templates { }; FilterTemplatesByName(query: string) { - return ObjectsRegistry.AggregateHelper.TypeText( + ObjectsRegistry.AggregateHelper.TypeText( this.locators._templatesSearchInput, query, ); + this.agHelper.Sleep(); } AssertResultsHeaderText( diff --git a/app/client/src/ce/utils/analyticsUtilTypes.ts b/app/client/src/ce/utils/analyticsUtilTypes.ts index cb5224418e..2400e910d2 100644 --- a/app/client/src/ce/utils/analyticsUtilTypes.ts +++ b/app/client/src/ce/utils/analyticsUtilTypes.ts @@ -335,7 +335,8 @@ export type EventName = | "COMMUNITY_TEMPLATE_PUBLISH_CLICK" | "EMAIL_VERIFICATION_SETTING_UPDATE" | "EMAIL_VERIFICATION_FAILED" - | "TIME_TO_NAVIGATE_ENTITY_EXPLORER"; + | "TIME_TO_NAVIGATE_ENTITY_EXPLORER" + | "TEMPLATES_SEARCH_INPUT_EVENT"; export type DATASOURCE_SCHEMA_EVENTS = | "DATASOURCE_SCHEMA_SEARCH" diff --git a/app/client/src/pages/Templates/index.tsx b/app/client/src/pages/Templates/index.tsx index 7a7cfe3727..af8c91cfc0 100644 --- a/app/client/src/pages/Templates/index.tsx +++ b/app/client/src/pages/Templates/index.tsx @@ -36,6 +36,8 @@ import type { Template } from "api/TemplatesApi"; import LoadingScreen from "./TemplatesModal/LoadingScreen"; import ReconnectDatasourceModal from "pages/Editor/gitSync/ReconnectDatasourceModal"; import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants"; +import { debounce } from "lodash"; +import AnalyticsUtil from "utils/AnalyticsUtil"; const SentryRoute = Sentry.withSentryRouting(Route); @@ -152,16 +154,17 @@ type TemplatesContentProps = { isForkingEnabled: boolean; filterWithAllowPageImport?: boolean; }; - +const INPUT_DEBOUNCE_TIMER = 500; export function TemplatesContent(props: TemplatesContentProps) { const templateSearchQuery = useSelector(getTemplateSearchQuery); const isFetchingApplications = useSelector(getIsFetchingApplications); const isFetchingTemplates = useSelector(isFetchingTemplatesSelector); const isLoading = isFetchingApplications || isFetchingTemplates; const dispatch = useDispatch(); - const onChange = (query: string) => { + const onChange = debounce((query: string) => { dispatch(setTemplateSearchQuery(query)); - }; + AnalyticsUtil.logEvent("TEMPLATES_SEARCH_INPUT_EVENT", { query }); + }, INPUT_DEBOUNCE_TIMER); const filterWithAllowPageImport = props.filterWithAllowPageImport || false; const templates = useSelector(getSearchedTemplateList).filter((template) => filterWithAllowPageImport ? !!template.allowPageImport : true,