Refactor Products component to import usePlayButtonStore alongside useResetButtonStore; update dependencies in useEffect for selectedProduct to include isPlaying. #86
|
@ -10,7 +10,7 @@ import { useArmBotStore } from '../../../store/simulation/useArmBotStore';
|
|||
import { useConveyorStore } from '../../../store/simulation/useConveyorStore';
|
||||
import { useMachineStore } from '../../../store/simulation/useMachineStore';
|
||||
import { useStorageUnitStore } from '../../../store/simulation/useStorageUnitStore';
|
||||
import { useResetButtonStore } from '../../../store/usePlayButtonStore';
|
||||
import { usePlayButtonStore, useResetButtonStore } from '../../../store/usePlayButtonStore';
|
||||
|
||||
function Products() {
|
||||
const { products, getProductById, addProduct, setProducts } = useProductStore();
|
||||
|
@ -21,6 +21,7 @@ function Products() {
|
|||
const { addConveyor, clearConveyors } = useConveyorStore();
|
||||
const { setCurrentMaterials, clearStorageUnits, updateCurrentLoad, addStorageUnit } = useStorageUnitStore();
|
||||
const { isReset } = useResetButtonStore();
|
||||
const { isPlaying } = usePlayButtonStore();
|
||||
|
||||
useEffect(() => {
|
||||
const email = localStorage.getItem('email')
|
||||
|
@ -121,7 +122,7 @@ function Products() {
|
|||
});
|
||||
}
|
||||
}
|
||||
}, [selectedProduct, products, isReset]);
|
||||
}, [selectedProduct, products, isReset, isPlaying]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
Loading…
Reference in New Issue