mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-12-12 02:35:42 +00:00
fix(Map): Refactor init and update of mapper
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user