Skip to content

Commit

Permalink
fix: Prevent submitting invalid regex with keyboard enter (#2228)
Browse files Browse the repository at this point in the history
Fixes #2227
  • Loading branch information
SuaYoo authored Dec 10, 2024
1 parent b7604ee commit 541298e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontend/src/features/crawl-workflows/queue-exclusion-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export class QueueExclusionForm extends LiteElement {

private readonly onKeyDown = (e: KeyboardEvent) => {
e.stopPropagation();
if (e.key === "Enter") {
if (e.key === "Enter" && !this.isRegexInvalid) {
void this.handleAdd();
}
};
Expand Down Expand Up @@ -217,7 +217,7 @@ export class QueueExclusionForm extends LiteElement {
private async handleAdd() {
this.onInput.flush();
await this.updateComplete;
if (!this.regex) return;
if (!this.regex || this.isRegexInvalid) return;

if (this.input) {
this.input.value = "";
Expand Down

0 comments on commit 541298e

Please sign in to comment.