mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-25 07:45:47 +00:00
fix(FE): fixing table flickering when input form value
This commit is contained in:
@@ -10,7 +10,7 @@ import {
|
||||
formatVechicleNumber,
|
||||
} from '@/lib/helper';
|
||||
import { Icon } from '@iconify/react';
|
||||
import { useMemo, useState } from 'react';
|
||||
import { useMemo, useRef, useState } from 'react';
|
||||
import * as TanStack from '@tanstack/react-table';
|
||||
import CheckboxInput from '@/components/input/CheckboxInput';
|
||||
|
||||
@@ -35,6 +35,9 @@ const SalesOrderProductTable = ({
|
||||
onBulkDelete,
|
||||
onAddProductClick,
|
||||
}: SalesOrderProductTableProps) => {
|
||||
const onDeleteRef = useRef(onDelete);
|
||||
onDeleteRef.current = onDelete;
|
||||
|
||||
const columns = useMemo(
|
||||
() => [
|
||||
{
|
||||
@@ -114,9 +117,9 @@ const SalesOrderProductTable = ({
|
||||
<Button
|
||||
color='error'
|
||||
className='p-1'
|
||||
onClick={() => {
|
||||
onDelete(props.row.original.id as number);
|
||||
}}
|
||||
onClick={() =>
|
||||
onDeleteRef.current(props.row.original.id as number)
|
||||
}
|
||||
type='button'
|
||||
>
|
||||
<Icon icon='mdi:trash' width={16} height={16} />
|
||||
@@ -125,7 +128,7 @@ const SalesOrderProductTable = ({
|
||||
),
|
||||
},
|
||||
],
|
||||
[onDelete]
|
||||
[]
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user