mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-12-11 02:05:58 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ba21f5386 | ||
|
|
10eeae5295 | ||
|
|
a5bead15d0 |
@@ -2,6 +2,11 @@
|
||||
|
||||
<!-- changelog -->
|
||||
|
||||
## [v1.19.1](https://github.com/wanderer-industries/wanderer/compare/v1.19.0...v1.19.1) (2024-11-19)
|
||||
|
||||
|
||||
|
||||
|
||||
## [v1.19.0](https://github.com/wanderer-industries/wanderer/compare/v1.18.1...v1.19.0) (2024-11-19)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
||||
import { useCallback, useRef } from 'react';
|
||||
import { CommandAddSystems, CommandRemoveSystems, CommandUpdateSystems } from '@/hooks/Mapper/types';
|
||||
import { useLoadSystemStatic } from '@/hooks/Mapper/mapRootProvider/hooks/useLoadSystemStatic.ts';
|
||||
|
||||
export const useCommandsSystems = () => {
|
||||
const {
|
||||
@@ -8,16 +9,22 @@ export const useCommandsSystems = () => {
|
||||
data: { systems },
|
||||
} = useMapRootState();
|
||||
|
||||
const { addSystemStatic } = useLoadSystemStatic({ systems: [] });
|
||||
|
||||
const ref = useRef({ systems, update });
|
||||
ref.current = { systems, update };
|
||||
|
||||
const addSystems = useCallback(
|
||||
(addSystems: CommandAddSystems) => {
|
||||
addSystems.forEach(sys => {
|
||||
addSystemStatic(sys.system_static_info);
|
||||
});
|
||||
|
||||
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) => {
|
||||
|
||||
@@ -24,7 +24,7 @@ interface UseLoadSystemStaticProps {
|
||||
systems: (number | string)[];
|
||||
}
|
||||
|
||||
export const useLoadSystemStatic = ({ systems }: UseLoadSystemStaticProps) => {
|
||||
export const useLoadSystemStatic = ({ systems = [] }: UseLoadSystemStaticProps) => {
|
||||
const { outCommand } = useMapRootState();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [lastUpdateKey, setLastUpdateKey] = useState(0);
|
||||
@@ -51,6 +51,9 @@ export const useLoadSystemStatic = ({ systems }: UseLoadSystemStaticProps) => {
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!systems.length) {
|
||||
return;
|
||||
}
|
||||
loadSystems(systems);
|
||||
// eslint-disable-next-line
|
||||
}, [systems]);
|
||||
|
||||
@@ -144,8 +144,6 @@ defmodule WandererAppWeb.MapSignaturesEventHandler do
|
||||
updated = updated_signatures |> Enum.find(fn u -> u.eve_id == s.eve_id end)
|
||||
|
||||
if not is_nil(updated) do
|
||||
IO.puts("Updating #{s.eve_id}")
|
||||
|
||||
s
|
||||
|> WandererApp.Api.MapSystemSignature.update(
|
||||
updated
|
||||
|
||||
Reference in New Issue
Block a user