Skip to content

Commit

Permalink
fix(OH2-384|OH2-402): Fix table filter crashing (#672)
Browse files Browse the repository at this point in the history
Co-authored-by: SteveGT96 <[email protected]>
  • Loading branch information
SteveGT96 and SteveGT96 authored Oct 8, 2024
1 parent 5b2773d commit 43bf482
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/accessories/table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ import {
import { TOrder } from "../../../libraries/sortUtils/types";
import Button from "../button/Button";
import ConfirmationDialog from "../confirmationDialog/ConfirmationDialog";
import TableBodyRow from "./TableBodyRow";
import { FilterButton } from "./filter/FilterButton";
import { TFilterValues } from "./filter/types";
import "./styles.scss";
import TableBodyRow from "./TableBodyRow";
import { IProps, TActions } from "./types";

const Table: FunctionComponent<IProps> = ({
Expand Down Expand Up @@ -399,7 +399,7 @@ const Table: FunctionComponent<IProps> = ({
field={filterField}
onChange={(value) =>
setFilters((previous) => ({
...filters,
...previous,
[filterField.key]: value,
}))
}
Expand Down
6 changes: 5 additions & 1 deletion src/components/accessories/table/filter/FilterButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ export const FilterButton = ({ field, onChange }: IOwnProps) => {
};

useEffect(() => {
formik.submitForm();
const submit = setTimeout(() => {
formik.submitForm();
}, 250);

return () => clearInterval(submit);
}, [formik.values]);

return (
Expand Down

0 comments on commit 43bf482

Please sign in to comment.