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

@@ -8,7 +8,7 @@ export const useMapCommands = () => {
const ref = useRef({ update });
ref.current = { update };
const mapUpdated = useCallback(({ hubs, system_signatures }: CommandMapUpdated) => {
const mapUpdated = useCallback(({ hubs, system_signatures, kills }: CommandMapUpdated) => {
const out: Partial<MapData> = {};
if (hubs) {
@@ -19,6 +19,10 @@ export const useMapCommands = () => {
out.systemSignatures = system_signatures;
}
if (kills) {
out.kills = kills.reduce((acc, x) => ({ ...acc, [x.solar_system_id]: x.kills }), {});
}
ref.current.update(out);
}, []);