Implement resetStates hook and integrate it into Header component for state management

This commit is contained in:
2025-06-24 11:04:56 +05:30
parent b49f431ebf
commit a5afcd5757
5 changed files with 56 additions and 3 deletions

View File

@@ -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(() => (
{