Open gcoutable opened 1 year ago
The issue may be fixed by making the payload from GetConnectorToolsEventHandler
not return a null
payload.
The issue may be fixed by making the payload from
GetConnectorToolsEventHandler
not return anull
payload.
That will not be enough (I tested). If the handler returns an empty list of candidate tools, the frontend never displays the context menu, so no edge tool is invoked.
edgeCreationFeedback.reset()
is never called on the frontend (it's normally invoked after we call a tool), so the edge creaation feedback stays active.FWIW, I had started an attempt to fix this:
diff --git a/packages/diagrams/backend/sirius-components-collaborative-diagrams/src/main/java/org/eclipse/sirius/components/collaborative/diagrams/handlers/GetConnectorToolsEventHandler.java b/packages/diagrams/backend/sirius-components-collaborative-diagrams/src/main/java/org/eclipse/sirius/components/collaborative/diagrams/handlers/GetConnectorToolsEventHandler.java
index af5b1af80..71fd41c0b 100644
--- a/packages/diagrams/backend/sirius-components-collaborative-diagrams/src/main/java/org/eclipse/sirius/components/collaborative/diagrams/handlers/GetConnectorToolsEventHandler.java
+++ b/packages/diagrams/backend/sirius-components-collaborative-diagrams/src/main/java/org/eclipse/sirius/components/collaborative/diagrams/handlers/GetConnectorToolsEventHandler.java
@@ -123,6 +123,8 @@ public class GetConnectorToolsEventHandler implements IDiagramEventHandler {
}
payload = new GetConnectorToolsSuccessPayload(diagramInput.getId(), connectorTools);
+ } else {
+ payload = new GetConnectorToolsSuccessPayload(diagramInput.getId(), List.of());
}
}
} else {
diff --git a/packages/diagrams/frontend/sirius-components-diagrams/src/palette/ContextualMenu.tsx b/packages/diagrams/frontend/sirius-components-diagrams/src/palette/ContextualMenu.tsx
index a3474ed41..777b1c14a 100644
--- a/packages/diagrams/frontend/sirius-components-diagrams/src/palette/ContextualMenu.tsx
+++ b/packages/diagrams/frontend/sirius-components-diagrams/src/palette/ContextualMenu.tsx
@@ -135,6 +135,13 @@ export const ContextualMenu = ({
}
});
+ // Close properly when there are no tools to propose.
+ useEffect(() => {
+ if (contextualMenu === 'loaded' && connectorTools.length === 0) {
+ invokeClose();
+ }
+ }, [contextualMenu, connectorTools, invokeClose]);
+
const onToolClick = useCallback(
(tool) => {
invokeTool(tool);
The patch is old, I don't remember if it fixed the issue completely or not. Feel free to ignore it if it is not relevant anymore.
Screenshots
Steps to reproduce
Create View
flow::System
)flow::CompositeProcessor
)flow::DataFlow
)Reproduce
Expected behavior
A sub-menu should display the two edge creation tool defined in the edge description.
Actual behavior
An error is raised instead of displaying available tools and, the edge creation feedback is still activated.