mirror of
https://github.com/inventree/InvenTree.git
synced 2026-07-21 22:23:03 +00:00
[bug] Bom table fix (#12436)
* Fix logic for table context menu * Memoize handleCellContextMenu
This commit is contained in:
@@ -766,7 +766,8 @@ export function InvenTreeTableInternal<T extends Record<string, any>>({
|
||||
}, [props.onCellContextMenu, props.rowActions, props.modelType]);
|
||||
|
||||
// Callback when a cell is right-clicked
|
||||
const handleCellContextMenu = ({
|
||||
const handleCellContextMenu = useCallback(
|
||||
({
|
||||
record,
|
||||
column,
|
||||
event
|
||||
@@ -818,7 +819,7 @@ export function InvenTreeTableInternal<T extends Record<string, any>>({
|
||||
icon: <IconArrowRight />,
|
||||
onClick: (event: any) => {
|
||||
cancelEvent(event);
|
||||
if (eventModified(event as any)) {
|
||||
if (!showPreviewPanel || eventModified(event as any)) {
|
||||
navigateToLink(url, navigate, event);
|
||||
} else {
|
||||
showRowPreview(pk);
|
||||
@@ -828,7 +829,19 @@ export function InvenTreeTableInternal<T extends Record<string, any>>({
|
||||
}
|
||||
|
||||
return showContextMenu?.(items)(event);
|
||||
};
|
||||
},
|
||||
[
|
||||
props.onCellContextMenu,
|
||||
props.rowActions,
|
||||
props.modelType,
|
||||
props.detailAction,
|
||||
props.modelField,
|
||||
showPreviewPanel,
|
||||
showRowPreview,
|
||||
showContextMenu,
|
||||
navigate
|
||||
]
|
||||
);
|
||||
|
||||
// Pagination refresh table if pageSize changes
|
||||
const updatePageSize = useCallback((size: number) => {
|
||||
|
||||
Reference in New Issue
Block a user