Skip to content

Commit

Permalink
Prevent removing all spaces from search term
Browse files Browse the repository at this point in the history
  • Loading branch information
sudhons committed Dec 2, 2024
1 parent 9d5cd76 commit 3442081
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/search-editor/utils/remove-text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ function escapeRegExp(text: string): string {
}

export function removeText(input: string, textToRemove: string): string {
return input.replace(new RegExp(escapeRegExp(textToRemove), GLOBAL_FLAG), '');
return input.replace(
new RegExp(escapeRegExp(textToRemove?.trim()), GLOBAL_FLAG),
'',
);
}

0 comments on commit 3442081

Please sign in to comment.