mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-09 15:10:54 +00:00
Fix useEffect dependencies (#9967)
- Passing an array to a useEffect dependency list apparently is problematic
This commit is contained in:
@ -77,7 +77,7 @@ function BomItemSubstituteRow({
|
||||
|
||||
type BomItemSubstituteFormProps = {
|
||||
bomItemId: number;
|
||||
substitutes: any[];
|
||||
bomItem: any;
|
||||
onClose?: () => void;
|
||||
};
|
||||
|
||||
@ -88,8 +88,8 @@ export function useEditBomSubstitutesForm(props: BomItemSubstituteFormProps) {
|
||||
const [substitutes, setSubstitutes] = useState<any[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
setSubstitutes(props.substitutes);
|
||||
}, [props.substitutes]);
|
||||
setSubstitutes(props.bomItem?.substitutes ?? []);
|
||||
}, [props.bomItem.substitutes]);
|
||||
|
||||
const formFields: ApiFormFieldSet = useMemo(() => {
|
||||
return {
|
||||
|
@ -428,7 +428,7 @@ export function BomTable({
|
||||
|
||||
const editSubstitues = useEditBomSubstitutesForm({
|
||||
bomItemId: selectedBomItem.pk,
|
||||
substitutes: selectedBomItem?.substitutes ?? [],
|
||||
bomItem: selectedBomItem,
|
||||
onClose: () => {
|
||||
table.refreshTable();
|
||||
}
|
||||
@ -501,7 +501,9 @@ export function BomTable({
|
||||
record.validated ||
|
||||
!user.hasChangeRole(UserRoles.part),
|
||||
icon: <IconCircleCheck />,
|
||||
onClick: () => validateBomItem(record)
|
||||
onClick: () => {
|
||||
validateBomItem(record);
|
||||
}
|
||||
},
|
||||
RowEditAction({
|
||||
hidden: partLocked || !user.hasChangeRole(UserRoles.part),
|
||||
|
Reference in New Issue
Block a user