mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-12-16 04:36:06 +00:00
chore: release version v1.18.1
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
||||||
import { useCallback, useRef } from 'react';
|
import { useCallback, useRef } from 'react';
|
||||||
import { CommandAddSystems, CommandRemoveSystems, CommandUpdateSystems } from '@/hooks/Mapper/types';
|
import { CommandAddSystems, CommandRemoveSystems, CommandUpdateSystems } from '@/hooks/Mapper/types';
|
||||||
|
import { useLoadSystemStatic } from '@/hooks/Mapper/mapRootProvider/hooks/useLoadSystemStatic.ts';
|
||||||
|
|
||||||
export const useCommandsSystems = () => {
|
export const useCommandsSystems = () => {
|
||||||
const {
|
const {
|
||||||
@@ -8,16 +9,22 @@ export const useCommandsSystems = () => {
|
|||||||
data: { systems },
|
data: { systems },
|
||||||
} = useMapRootState();
|
} = useMapRootState();
|
||||||
|
|
||||||
|
const { addSystemStatic } = useLoadSystemStatic({ systems: [] });
|
||||||
|
|
||||||
const ref = useRef({ systems, update });
|
const ref = useRef({ systems, update });
|
||||||
ref.current = { systems, update };
|
ref.current = { systems, update };
|
||||||
|
|
||||||
const addSystems = useCallback(
|
const addSystems = useCallback(
|
||||||
(addSystems: CommandAddSystems) => {
|
(addSystems: CommandAddSystems) => {
|
||||||
|
addSystems.forEach(sys => {
|
||||||
|
addSystemStatic(sys.system_static_info);
|
||||||
|
});
|
||||||
|
|
||||||
update({
|
update({
|
||||||
systems: [...ref.current.systems.filter(sys => addSystems.some(x => sys.id !== x.id)), ...addSystems],
|
systems: [...ref.current.systems.filter(sys => !addSystems.some(x => sys.id === x.id)), ...addSystems],
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
[update],
|
[addSystemStatic, update],
|
||||||
);
|
);
|
||||||
|
|
||||||
const removeSystems = useCallback((toRemove: CommandRemoveSystems) => {
|
const removeSystems = useCallback((toRemove: CommandRemoveSystems) => {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ interface UseLoadSystemStaticProps {
|
|||||||
systems: (number | string)[];
|
systems: (number | string)[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useLoadSystemStatic = ({ systems }: UseLoadSystemStaticProps) => {
|
export const useLoadSystemStatic = ({ systems = [] }: UseLoadSystemStaticProps) => {
|
||||||
const { outCommand } = useMapRootState();
|
const { outCommand } = useMapRootState();
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [lastUpdateKey, setLastUpdateKey] = useState(0);
|
const [lastUpdateKey, setLastUpdateKey] = useState(0);
|
||||||
@@ -51,6 +51,9 @@ export const useLoadSystemStatic = ({ systems }: UseLoadSystemStaticProps) => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (!systems.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
loadSystems(systems);
|
loadSystems(systems);
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
}, [systems]);
|
}, [systems]);
|
||||||
|
|||||||
@@ -144,8 +144,6 @@ defmodule WandererAppWeb.MapSignaturesEventHandler do
|
|||||||
updated = updated_signatures |> Enum.find(fn u -> u.eve_id == s.eve_id end)
|
updated = updated_signatures |> Enum.find(fn u -> u.eve_id == s.eve_id end)
|
||||||
|
|
||||||
if not is_nil(updated) do
|
if not is_nil(updated) do
|
||||||
IO.puts("Updating #{s.eve_id}")
|
|
||||||
|
|
||||||
s
|
s
|
||||||
|> WandererApp.Api.MapSystemSignature.update(
|
|> WandererApp.Api.MapSystemSignature.update(
|
||||||
updated
|
updated
|
||||||
|
|||||||
Reference in New Issue
Block a user