Skip to content

Commit 84413cd

Browse files
Copilothuangyiirene
andcommitted
Address code review feedback - improve ID generation and type safety
Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
1 parent 2575614 commit 84413cd

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

packages/components/src/ui/filter-builder.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function FilterBuilder({
6060
)
6161

6262
React.useEffect(() => {
63-
if (value && value !== filterGroup) {
63+
if (value && JSON.stringify(value) !== JSON.stringify(filterGroup)) {
6464
setFilterGroup(value)
6565
}
6666
}, [value])
@@ -72,7 +72,7 @@ function FilterBuilder({
7272

7373
const addCondition = () => {
7474
const newCondition: FilterCondition = {
75-
id: `condition-${Date.now()}`,
75+
id: `condition-${crypto.randomUUID()}`,
7676
field: fields[0]?.value || "",
7777
operator: "equals",
7878
value: "",
@@ -190,7 +190,7 @@ function FilterBuilder({
190190
<Input
191191
className="h-9 text-sm"
192192
placeholder="Value"
193-
value={condition.value as string}
193+
value={String(condition.value || "")}
194194
onChange={(e) =>
195195
updateCondition(condition.id, { value: e.target.value })
196196
}

0 commit comments

Comments
 (0)