Skip to content

Commit

Permalink
Fix filters (#810)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
adhityamamallan authored Feb 6, 2025
1 parent 13bb5cc commit 173e320
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ describe(PageFiltersSearch.name, () => {
expect(mockSetQueryParams).toHaveBeenCalledWith({ search: 'test-search' });
});

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

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

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

expect(mockSetQueryParams).toHaveBeenCalledWith({ search: 'test-search' });
expect(mockSetQueryParams).toHaveBeenCalledWith({ search: 'test search ' });
});

it('should prune symbols from input text if regexp is passed', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function PageFiltersSearch<
pageQueryParamsConfig,
searchQueryParamKey,
searchPlaceholder,
searchTrimRegExp = /['"\s]/g,
searchTrimRegExp = /^\s+|['"]/g,
inputDebounceDurationMs,
}: Props<P, K>) {
const [queryParams, setQueryParams] = usePageQueryParams(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const listWorkflowsQueryParamSchema = z
),
listType: z.enum(['default', 'archived']),
inputType: z.enum(['search', 'query']),
search: z.string().optional(),
search: z.string().trim().optional(),
query: z.string().optional(),
status: z
.custom<WorkflowStatus>(isWorkflowStatus, {
Expand Down

0 comments on commit 173e320

Please sign in to comment.