Implement resetStates hook and integrate it into Header component for state management
This commit is contained in:
@@ -28,6 +28,8 @@ type SceneContextValue = {
|
||||
vehicleStore: VehicleStoreType;
|
||||
storageUnitStore: StorageUnitStoreType;
|
||||
|
||||
clearStores: () => void;
|
||||
|
||||
layout: 'Main Layout' | 'Comparison Layout';
|
||||
};
|
||||
|
||||
@@ -55,8 +57,17 @@ export function SceneProvider({
|
||||
const storageUnitStore = useMemo(() => createStorageUnitStore(), []);
|
||||
|
||||
const clearStores = useMemo(() => () => {
|
||||
assetStore().clearAssets();
|
||||
}, [assetStore]);
|
||||
assetStore.getState().clearAssets();
|
||||
aisleStore.getState().clearAisles();
|
||||
eventStore.getState().clearEvents();
|
||||
productStore.getState().clearProducts();
|
||||
materialStore.getState().clearMaterials();
|
||||
armBotStore.getState().clearArmBots();
|
||||
machineStore.getState().clearMachines();
|
||||
conveyorStore.getState().clearConveyors();
|
||||
vehicleStore.getState().clearVehicles();
|
||||
storageUnitStore.getState().clearStorageUnits();
|
||||
}, [assetStore, aisleStore, eventStore, productStore, materialStore, armBotStore, machineStore, conveyorStore, vehicleStore, storageUnitStore]);
|
||||
|
||||
const contextValue = useMemo(() => (
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user