fix(Core): Fix adding systems on splash (#71)

* fix(Core): Fix adding systems on splash
This commit is contained in:
Dmitry Popov
2024-11-20 18:08:59 +04:00
committed by GitHub
parent 080af16d41
commit 0002979fda
6 changed files with 21 additions and 13 deletions

View File

@@ -12,6 +12,7 @@ export const useMapAddSystems = () => {
return useCallback((systems: CommandAddSystems) => {
const { rf } = ref.current;
const nodes = rf.getNodes();
const prepared: Node[] = systems.filter(x => !nodes.some(y => x.id === y.id)).map(convertSystem2Node);
rf.addNodes(prepared);
}, []);

View File

@@ -112,13 +112,17 @@ export const useMapHandlers = (ref: ForwardedRef<MapHandlers>, onSelectionChange
connections: [],
});
selectSystem(systemId as CommandSelectSystem);
}, 100);
}, 500);
break;
case Commands.routes:
// do nothing here
break;
case Commands.signaturesUpdated:
// do nothing here
break;
case Commands.linkSignatureToSystem:
// do nothing here
break;

View File

@@ -87,6 +87,14 @@ export const useMapRootHandlers = (ref: ForwardedRef<MapHandlers>) => {
mapRoutes(data as CommandRoutes);
break;
case Commands.signaturesUpdated: // USED
// do nothing here
break;
case Commands.linkSignatureToSystem: // USED
// do nothing here
break;
case Commands.centerSystem: // USED
// do nothing here
break;
@@ -95,22 +103,10 @@ export const useMapRootHandlers = (ref: ForwardedRef<MapHandlers>) => {
// do nothing here
break;
// case Commands.linkSignatureToSystem:
// // TODO command data type lost
// // @ts-ignore
// emitMapEvent({ name: Commands.linkSignatureToSystem, data });
// break;
case Commands.killsUpdated:
// do nothing here
break;
// case Commands.signaturesUpdated:
// // TODO command data type lost
// // @ts-ignore
// emitMapEvent({ name: Commands.signaturesUpdated, data });
// break;
default:
console.warn(`JOipP Interface handlers: Unknown command: ${type}`, data);
break;

View File

@@ -18,6 +18,7 @@
"@shopify/draggable": "^1.1.3",
"clsx": "^2.1.1",
"daisyui": "^4.11.1",
"jotai": "^2.10.2",
"live_select": "file:../deps/live_select",
"lodash.debounce": "^4.0.8",
"lodash.isequal": "^4.5.0",

View File

@@ -2598,6 +2598,11 @@ jiti@^1.19.1:
resolved "https://registry.npmjs.org/jiti/-/jiti-1.21.0.tgz"
integrity sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==
jotai@^2.10.2:
version "2.10.2"
resolved "https://registry.yarnpkg.com/jotai/-/jotai-2.10.2.tgz#c5fe5419e0526c262d401d6033f7a2c0049ce1b4"
integrity sha512-DqsBTlRglIBviuJLfK6JxZzpd6vKfbuJ4IqRCz70RFEDeZf46Fcteb/FXxNr1UnoxR5oUy3oq7IE8BrEq0G5DQ==
"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0:
version "4.0.0"
resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz"

View File

@@ -1897,6 +1897,7 @@ defmodule WandererApp.Map.Server.Impl do
)
WandererApp.Map.add_system(map_id, updated_system)
broadcast!(map_id, :add_system, updated_system)
:ok