Skip to content

Commit

Permalink
chore: update data input view to handle empty values
Browse files Browse the repository at this point in the history
  • Loading branch information
lawvs committed Aug 6, 2024
1 parent 3d04bc5 commit 75feec4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .changeset/nice-deers-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@fn-sphere/filter": patch
---

Update data input view to handle empty values

If input value is empty string, the input view will update the rule args to `[]` instead of `[""]`. This is to prevent the rule from running with an empty string as an argument.
4 changes: 4 additions & 0 deletions packages/filter/src/views/data-input-views.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export const presetDataInputSpecs: DataInputViewSpec[] = [
type="text"
value={(rule.args?.[0] as string) ?? ""}
onChange={(value) => {
if (!value.length) {
updateInput([]);
return;
}
updateInput([value]);
return;
}}
Expand Down

0 comments on commit 75feec4

Please sign in to comment.