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,13 +8,29 @@ export const useMapUpdated = () => {
const ref = useRef({ update });
ref.current = { update };
return useCallback(({ hubs }: CommandMapUpdated) => {
return useCallback((props: CommandMapUpdated) => {
const { update } = ref.current;
const out: Partial<MapRootData> = {};
if (hubs) {
out.hubs = hubs;
if ('hubs' in props) {
out.hubs = props.hubs;
}
if ('system_signatures' in props) {
out.systemSignatures = props.system_signatures;
}
if ('following_character_eve_id' in props) {
out.userCharacters = props.user_characters;
}
if ('following_character_eve_id' in props) {
out.followingCharacterEveId = props.following_character_eve_id;
}
if ('main_character_eve_id' in props) {
out.mainCharacterEveId = props.main_character_eve_id;
}
update(out);