fix(Map): Refactor init and update of mapper

This commit is contained in:
achichenkov
2025-04-23 08:57:55 +03:00
parent 4e732e9491
commit c9b366f3e2
8 changed files with 51 additions and 18 deletions

View File

@@ -17,12 +17,13 @@ function usePrevious<T>(value: T): T | undefined {
}
export const useLoadRoutes = () => {
// TODO ??
const [loading, setLoading] = useState(false);
const { data: routesSettings } = useRouteProvider();
const {
outCommand,
data: { selectedSystems, hubs, systems, connections },
data: { selectedSystems, hubs, systems, connections, routes },
} = useMapRootState();
const prevSys = usePrevious(systems);
@@ -38,10 +39,15 @@ export const useLoadRoutes = () => {
routes_settings: routesSettings,
},
});
setLoading(true);
},
[outCommand],
);
useEffect(() => {
setLoading(false);
}, [routes]);
useEffect(() => {
if (selectedSystems.length !== 1) {
return;