Skip to content

Commit 0d70257

Browse files
adhityamamallanAssem-Uber
authored andcommitted
Fix filters (#810)
Instead of pruning all spaces from the workflow search bar, we will now prune only the leading space in the UI, and prune the trailing space on the server side. This will allow users to search for workflows with spaces in the name/type.
1 parent f5a85ce commit 0d70257

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/components/page-filters/page-filters-search/__tests__/page-filters-search.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ describe(PageFiltersSearch.name, () => {
3333
expect(mockSetQueryParams).toHaveBeenCalledWith({ search: 'test-search' });
3434
});
3535

36-
it('should prune quotes and spaces from input text if no regexp is passed', async () => {
36+
it('should prune quotes and start spaces from input text if no regexp is passed', async () => {
3737
const { user } = setup({});
3838

3939
const searchInput = await screen.findByRole('textbox');
4040

41-
await user.type(searchInput, ` "test-search'`);
41+
await user.type(searchInput, ` "test search' `);
4242

43-
expect(mockSetQueryParams).toHaveBeenCalledWith({ search: 'test-search' });
43+
expect(mockSetQueryParams).toHaveBeenCalledWith({ search: 'test search ' });
4444
});
4545

4646
it('should prune symbols from input text if regexp is passed', async () => {

src/components/page-filters/page-filters-search/page-filters-search.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default function PageFiltersSearch<
2121
pageQueryParamsConfig,
2222
searchQueryParamKey,
2323
searchPlaceholder,
24-
searchTrimRegExp = /['"\s]/g,
24+
searchTrimRegExp = /^\s+|['"]/g,
2525
inputDebounceDurationMs,
2626
}: Props<P, K>) {
2727
const [queryParams, setQueryParams] = usePageQueryParams(

src/route-handlers/list-workflows/schemas/list-workflows-query-params-schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const listWorkflowsQueryParamSchema = z
1414
),
1515
listType: z.enum(['default', 'archived']),
1616
inputType: z.enum(['search', 'query']),
17-
search: z.string().optional(),
17+
search: z.string().trim().optional(),
1818
query: z.string().optional(),
1919
status: z
2020
.custom<WorkflowStatus>(isWorkflowStatus, {

0 commit comments

Comments
 (0)