[bug] Bom table fix (#12436)

* Fix logic for table context menu

* Memoize handleCellContextMenu
This commit is contained in:
Oliver
2026-07-21 16:12:00 +10:00
committed by GitHub
parent 0c8dd5dac1
commit 4739d59c0b
@@ -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) => {