mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-24 15:25:46 +00:00
fix: update dependencies in multiple tables to include updateSortingFilter in effect dependencies
This commit is contained in:
@@ -116,7 +116,9 @@ const ProductsTable = () => {
|
||||
);
|
||||
|
||||
const deleteModal = useModal();
|
||||
const [selectedProduct, setSelectedProduct] = useState<Product | undefined>(undefined);
|
||||
const [selectedProduct, setSelectedProduct] = useState<Product | undefined>(
|
||||
undefined
|
||||
);
|
||||
const [isDeleteLoading, setIsDeleteLoading] = useState(false);
|
||||
const [sorting, setSorting] = useState<SortingState>([]);
|
||||
|
||||
@@ -153,12 +155,14 @@ const ProductsTable = () => {
|
||||
{
|
||||
accessorKey: 'product_price',
|
||||
header: 'Harga Produk',
|
||||
cell: (props) => props.row.original.product_price?.toLocaleString() ?? '-',
|
||||
cell: (props) =>
|
||||
props.row.original.product_price?.toLocaleString() ?? '-',
|
||||
},
|
||||
{
|
||||
accessorKey: 'selling_price',
|
||||
header: 'Harga Jual',
|
||||
cell: (props) => props.row.original.selling_price?.toLocaleString() ?? '-',
|
||||
cell: (props) =>
|
||||
props.row.original.selling_price?.toLocaleString() ?? '-',
|
||||
},
|
||||
{
|
||||
accessorKey: 'tax',
|
||||
@@ -261,13 +265,15 @@ const ProductsTable = () => {
|
||||
const nameSortFilter = sorting.find((sortItem) => sortItem.id === 'name');
|
||||
const skuSortFilter = sorting.find((sortItem) => sortItem.id === 'sku');
|
||||
const brandSortFilter = sorting.find((sortItem) => sortItem.id === 'brand');
|
||||
const categorySortFilter = sorting.find((sortItem) => sortItem.id === 'product_category');
|
||||
const categorySortFilter = sorting.find(
|
||||
(sortItem) => sortItem.id === 'product_category'
|
||||
);
|
||||
|
||||
updateSortingFilter('nameSort', nameSortFilter);
|
||||
updateSortingFilter('skuSort', skuSortFilter);
|
||||
updateSortingFilter('brandSort', brandSortFilter);
|
||||
updateSortingFilter('categorySort', categorySortFilter);
|
||||
}, [sorting]);
|
||||
}, [sorting, updateSortingFilter]);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -347,4 +353,4 @@ const ProductsTable = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default ProductsTable;
|
||||
export default ProductsTable;
|
||||
|
||||
Reference in New Issue
Block a user