Skip to content

Commit

Permalink
fix: fix config list search filter not working
Browse files Browse the repository at this point in the history
  • Loading branch information
mainawycliffe authored and moshloop committed Jun 13, 2024
1 parent 9d1d59b commit 99606d0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/components/Forms/Formik/FormikSearchInputClearable.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { TextInputClearable } from "@flanksource-ui/ui/FormControls/TextInputClearable";
import { useField } from "formik";
import { debounce } from "lodash";
import { ComponentProps } from "react";
import React, { ComponentProps } from "react";

type FormikSearchInputClearableProps = {
name: string;
Expand All @@ -26,16 +26,20 @@ export default function FormikSearchInputClearable({
}
});

const onChange = debounce((value) => {
const onChange = debounce((e: React.ChangeEvent<HTMLInputElement>) => {
field.onChange({
target: {
value,
value: e.target.value,
name
}
});
}, 400);

return (
<TextInputClearable {...props} value={field.value} onChange={onChange} />
<TextInputClearable
{...props}
defaultValue={field.value}
onChange={onChange}
/>
);
}

0 comments on commit 99606d0

Please sign in to comment.