chore: release version v1.18.1

This commit is contained in:
Dmitry Popov
2024-11-19 17:06:35 +01:00
parent 1db65965d0
commit a5bead15d0
3 changed files with 13 additions and 5 deletions

View File

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

View File

@@ -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]);

View File

@@ -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