From c22f07c84daab1fa4144189baf9c2df6fb818359 Mon Sep 17 00:00:00 2001 From: Adam Obuchowicz Date: Fri, 12 Jan 2024 14:18:10 +0100 Subject: [PATCH 1/2] Fixes --- app/gui2/mock/providers.ts | 2 -- app/gui2/playwright.config.ts | 2 +- .../src/components/GraphEditor/NodeWidget.vue | 1 + .../GraphEditor/widgets/WidgetFunction.vue | 4 +++- .../GraphEditor/widgets/WidgetPort.vue | 12 +----------- .../GraphEditor/widgets/WidgetSelection.vue | 2 +- app/gui2/src/composables/selection.ts | 19 ++++++++++++++----- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/app/gui2/mock/providers.ts b/app/gui2/mock/providers.ts index 06160350874b..51c5c4e2a8fc 100644 --- a/app/gui2/mock/providers.ts +++ b/app/gui2/mock/providers.ts @@ -25,8 +25,6 @@ export const graphSelection: GraphSelection = { events: {} as any, anchor: undefined, deselectAll: () => {}, - addHoveredPort: () => new Set(), - removeHoveredPort: () => false, handleSelectionOf: () => {}, hoveredNode: undefined, hoveredPort: undefined, diff --git a/app/gui2/playwright.config.ts b/app/gui2/playwright.config.ts index 06cd20c2415c..596a73cd1051 100644 --- a/app/gui2/playwright.config.ts +++ b/app/gui2/playwright.config.ts @@ -85,7 +85,7 @@ export default defineConfig({ env: { E2E: 'true', }, - command: 'vite build && vite preview', + command: 'npx vite build && npx vite preview', port: 4173, // We use our special, mocked version of server, thus do not want to re-use user's one. reuseExistingServer: false, diff --git a/app/gui2/src/components/GraphEditor/NodeWidget.vue b/app/gui2/src/components/GraphEditor/NodeWidget.vue index dadf73d8b70d..114dcd6b533c 100644 --- a/app/gui2/src/components/GraphEditor/NodeWidget.vue +++ b/app/gui2/src/components/GraphEditor/NodeWidget.vue @@ -98,6 +98,7 @@ const spanStart = computed(() => { :input="props.input" :nesting="nesting" :data-span-start="spanStart" + :data-port="props.input.portId" @update="updateHandler" /> { if (props.input.dynamicConfig?.kind === 'FunctionCall') return props.input.dynamicConfig const data = visualizationData.value - if (data != null && data.ok) { + if (data?.ok) { const parseResult = argsWidgetConfigurationSchema.safeParse(data.value) if (parseResult.success) { return functionCallConfiguration(parseResult.data) } else { console.error('Unable to parse widget configuration.', data, parseResult.error) } + } else if (data != null && !data.ok) { + data.error.log('Cannot load dynamic configuration') } return undefined }) diff --git a/app/gui2/src/components/GraphEditor/widgets/WidgetPort.vue b/app/gui2/src/components/GraphEditor/widgets/WidgetPort.vue index b14da1171270..72bded4e0820 100644 --- a/app/gui2/src/components/GraphEditor/widgets/WidgetPort.vue +++ b/app/gui2/src/components/GraphEditor/widgets/WidgetPort.vue @@ -35,7 +35,7 @@ const navigator = injectGraphNavigator() const tree = injectWidgetTree() const selection = injectGraphSelection(true) -const isHovered = ref(false) +const isHovered = computed(() => selection?.hoveredPort === props.input.portId) const hasConnection = computed( () => graph.db.connections.reverseLookup(portId.value as ExprId).size > 0, @@ -48,14 +48,6 @@ const connected = computed(() => hasConnection.value || isCurrentEdgeHoverTarget const rootNode = shallowRef() const nodeSize = useResizeObserver(rootNode, false) -watchEffect((onCleanup) => { - if (selection != null && isHovered.value === true) { - const id = portId.value - selection.addHoveredPort(id) - onCleanup(() => selection.removeHoveredPort(id)) - } -}) - // Compute the scene-space bounding rectangle of the expression's widget. Those bounds are later // used for edge positioning. Querying and updating those bounds is relatively expensive, so we only // do it when the node has any potential for being used as an edge source or target. This is true @@ -155,8 +147,6 @@ export const widgetDefinition = defineWidget(WidgetInput.isAstOrPlaceholder, { }" :data-id="portId" :data-h="randSlice" - @pointerenter="isHovered = true" - @pointerleave="isHovered = false" > diff --git a/app/gui2/src/components/GraphEditor/widgets/WidgetSelection.vue b/app/gui2/src/components/GraphEditor/widgets/WidgetSelection.vue index 08f8dc0a3554..c545f143f531 100644 --- a/app/gui2/src/components/GraphEditor/widgets/WidgetSelection.vue +++ b/app/gui2/src/components/GraphEditor/widgets/WidgetSelection.vue @@ -85,7 +85,7 @@ export const widgetDefinition = defineWidget(WidgetInput.isAstOrPlaceholder, {