From 0092b0bbf5b2bd87c534f5affc49a3cf1d374216 Mon Sep 17 00:00:00 2001 From: Cristian Date: Thu, 25 Jun 2026 19:34:55 +0200 Subject: [PATCH 1/2] Fix single connection rendering --- .../connectionsMenu/connectionList.tsx | 7 ++- test/widgets/connectionsList.test.tsx | 55 +++++++++++++++++++ 2 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 test/widgets/connectionsList.test.tsx diff --git a/src/widgets/connectionsMenu/connectionList.tsx b/src/widgets/connectionsMenu/connectionList.tsx index a2150545..8af4928e 100644 --- a/src/widgets/connectionsMenu/connectionList.tsx +++ b/src/widgets/connectionsMenu/connectionList.tsx @@ -77,9 +77,10 @@ export function ConnectionsList(props: { count: inexact && totalCount > 0 ? 'some' : totalCount, }); entries.push({type: 'separator'}); - for (const entry of regularEntries) { - entries.push(entry); - } + } + + for (const entry of regularEntries) { + entries.push(entry); } if (probableEntries.length > 0) { diff --git a/test/widgets/connectionsList.test.tsx b/test/widgets/connectionsList.test.tsx new file mode 100644 index 00000000..6960a679 --- /dev/null +++ b/test/widgets/connectionsList.test.tsx @@ -0,0 +1,55 @@ +import * as React from 'react'; +import { describe, expect, it } from 'vitest'; +import { render } from 'vitest-browser-react'; + +import { type Translation, TranslationProvider } from '../../src/coreUtils/i18n'; +import { ConnectionsList } from '../../src/widgets/connectionsMenu/connectionList'; +import { + WorkspaceContext, + type WorkspaceContext as WorkspaceContextType, +} from '../../src/workspace/workspaceContext'; + +const link = {id: 'iri', label: []}; +const translation = { + formatLabel: () => 'relation', + text: (key: string) => key, +} as unknown as Translation; +const workspace = { + model: { + language: 'en', + locale: {formatIri: (value: string) => value}, + operations: [], + getLinkType: () => undefined, + getOperationFailReason: () => undefined, + events: { + on: () => undefined, + off: () => undefined, + }, + }, +} as unknown as WorkspaceContextType; + +describe('ConnectionsList', () => { + it('renders the only connection link', async () => { + await render( + + + undefined} + onMoveToFilter={undefined} + scrolledListRef={React.createRef()} + /> + + + ); + + expect(document.body.textContent).toContain('relation'); + }); +}); From be9b394efd04be2137eb8dc22bfa1055c4b86cf9 Mon Sep 17 00:00:00 2001 From: Alexey Morozov Date: Fri, 10 Jul 2026 22:52:40 +0300 Subject: [PATCH 2/2] Clean up `ConnectionList` test, update CHANGELOG --- CHANGELOG.md | 1 + .../connectionsMenu/connectionList.tsx | 4 +- test/widgets/connectionsList.test.tsx | 68 +++++++------------ 3 files changed, 29 insertions(+), 44 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3efcd3b3..39aca1a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p #### 🐛 Fixed - Fix relation having changed `data` but missing from `AuthoringState` when the source or target entity becomes deleted then restored back. - Fix grouped relation (`RelationGroup` item) does not updating its `data` when changed by `EditorController`. +- Fix `ConnectionsMenu` displaying no links when there is only a single incoming/outgoing relation type. (by @cristianvasquez) - Exclude collapsed `DropdownMenu` and `UnifiedSearch` content from Tab-navigation. - Exclude canvas elements from Tab-navigation unless the element is only one selected. - Block canvas interacton (including Tab-navigation) when displaying a blocking modal overlay i.e. an overlay task or viewport-centered dialog. diff --git a/src/widgets/connectionsMenu/connectionList.tsx b/src/widgets/connectionsMenu/connectionList.tsx index 8af4928e..df0f4080 100644 --- a/src/widgets/connectionsMenu/connectionList.tsx +++ b/src/widgets/connectionsMenu/connectionList.tsx @@ -25,9 +25,9 @@ export function ConnectionsList(props: { allRelatedLink: LinkTypeModel; onExpandLink: (chunk: LinkDataChunk) => void; - onMoveToFilter: ((chunk: LinkDataChunk) => void) | undefined; + onMoveToFilter?: (chunk: LinkDataChunk) => void; - scrolledListRef: React.RefObject; + scrolledListRef?: React.RefObject; }) { const { data, filterKey, sortMode, suggestions, diff --git a/test/widgets/connectionsList.test.tsx b/test/widgets/connectionsList.test.tsx index 6960a679..735bed2f 100644 --- a/test/widgets/connectionsList.test.tsx +++ b/test/widgets/connectionsList.test.tsx @@ -2,54 +2,38 @@ import * as React from 'react'; import { describe, expect, it } from 'vitest'; import { render } from 'vitest-browser-react'; -import { type Translation, TranslationProvider } from '../../src/coreUtils/i18n'; +import type { LinkTypeModel } from '../../src/data/model'; import { ConnectionsList } from '../../src/widgets/connectionsMenu/connectionList'; -import { - WorkspaceContext, - type WorkspaceContext as WorkspaceContextType, -} from '../../src/workspace/workspaceContext'; - -const link = {id: 'iri', label: []}; -const translation = { - formatLabel: () => 'relation', - text: (key: string) => key, -} as unknown as Translation; -const workspace = { - model: { - language: 'en', - locale: {formatIri: (value: string) => value}, - operations: [], - getLinkType: () => undefined, - getOperationFailReason: () => undefined, - events: { - on: () => undefined, - off: () => undefined, - }, - }, -} as unknown as WorkspaceContextType; +import { WorkspaceProvider, createWorkspace } from '../../src/workspace/workspaceProvider'; +import { blockingDefaultLayout } from '../../src/layout-sync'; describe('ConnectionsList', () => { it('renders the only connection link', async () => { + const link: LinkTypeModel = {id: 'urn:test:single-link', label: []}; + const workspace = createWorkspace({ + defaultLayout: blockingDefaultLayout, + }); + await render( - - - undefined} - onMoveToFilter={undefined} - scrolledListRef={React.createRef()} - /> - - + + undefined} + /> + ); - expect(document.body.textContent).toContain('relation'); + expect(document.body.querySelector( + '[data-linktypeid="urn:test:single-link"]' + )).toBeTruthy(); }); });