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 a2150545..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, @@ -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..735bed2f --- /dev/null +++ b/test/widgets/connectionsList.test.tsx @@ -0,0 +1,39 @@ +import * as React from 'react'; +import { describe, expect, it } from 'vitest'; +import { render } from 'vitest-browser-react'; + +import type { LinkTypeModel } from '../../src/data/model'; +import { ConnectionsList } from '../../src/widgets/connectionsMenu/connectionList'; +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} + /> + + ); + + expect(document.body.querySelector( + '[data-linktypeid="urn:test:single-link"]' + )).toBeTruthy(); + }); +});