add more checks

This commit is contained in:
Mutasem 2021-11-05 14:00:34 +01:00
parent 478e7dd30a
commit 2efeb8c51e
2 changed files with 9 additions and 8 deletions

View file

@ -1369,7 +1369,7 @@ export default mixins(
return;
}
if (info.connection === activeConnection) {
if (!info.connection || info.connection === activeConnection) {
return;
}
@ -1378,9 +1378,10 @@ export default mixins(
enterTimer = setTimeout(() => {
enterTimer = undefined;
activeConnection = info.connection;
CanvasHelpers.showConectionActions(info.connection);
if (info.connection) {
activeConnection = info.connection;
CanvasHelpers.showConectionActions(info.connection);
}
}, 150);
} catch (e) {
console.error(e);
@ -1398,14 +1399,14 @@ export default mixins(
enterTimer = undefined;
}
if (activeConnection !== info.connection) {
if (!info.connection || activeConnection !== info.connection) {
return;
}
exitTimer = setTimeout(() => {
exitTimer = undefined;
if (activeConnection === info.connection) {
if (info.connection && activeConnection === info.connection) {
CanvasHelpers.hideConnectionActions(activeConnection);
activeConnection = null;
}

View file

@ -380,7 +380,7 @@ export const getBackgroundStyles = (scale: number, offsetPosition: XYPosition) =
};
export const hideConnectionActions = (connection: Connection | null) => {
if (connection) {
if (connection && connection.connector) {
hideOverlay(connection, OVERLAY_CONNECTION_ACTIONS_ID);
showOrHideItemsLabel(connection);
showOrHideMidpointArrow(connection);
@ -388,7 +388,7 @@ export const hideConnectionActions = (connection: Connection | null) => {
};
export const showConectionActions = (connection: Connection | null) => {
if (connection) {
if (connection && connection.connector) {
showOverlay(connection, OVERLAY_CONNECTION_ACTIONS_ID);
hideOverlay(connection, OVERLAY_RUN_ITEMS_ID);
if (!getOverlay(connection, OVERLAY_RUN_ITEMS_ID)) {