Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/outline/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@

const EXPLORER_PROVIDER_TAG = 'solid-ui-file-explorer-provider'

export function dismissErrorStateOnClose (errorState) {
errorState.addEventListener('close', () => errorState.remove())
}

export default function (context) {
const dom = context.dom
const explorerStates = new WeakMap()
Expand Down Expand Up @@ -127,7 +131,7 @@

// Represent an object in summary form as a content block

function appendRemoveIcon (node, subject, removeNode) {

Check warning on line 134 in src/outline/manager.js

View workflow job for this annotation

GitHub Actions / build (22)

'appendRemoveIcon' is defined but never used

Check warning on line 134 in src/outline/manager.js

View workflow job for this annotation

GitHub Actions / build (24)

'appendRemoveIcon' is defined but never used
const image = UI.utils.AJARImage(
outlineIcons.src.icon_remove_node,
'remove',
Expand Down Expand Up @@ -1719,6 +1723,7 @@
errorState.setAttribute('title', 'Access denied')
errorState.setAttribute('message', soloAccessMessage())
if (docUri) errorState.setAttribute('data-outline-error-for', docUri)
dismissErrorStateOnClose(errorState)
UI.utils.emptyNode(p).appendChild(errorState)
sf.addCallback('done', function soloAccessRecovered (uri) {
if (!soloAccessDenied || !p.isConnected) return false
Expand Down
12 changes: 11 additions & 1 deletion test/unit/outline/manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ vi.mock('pane-registry', () => ({
byName: vi.fn()
}))

import OutlineManager from '../../../src/outline/manager'
import OutlineManager, { dismissErrorStateOnClose } from '../../../src/outline/manager'
import { onNavigated, type NavigatedDetail } from '../../../src/navigation/events'
import { lit, NamedNode, sym, blankNode } from 'rdflib'
import { findByText, getByText } from '@testing-library/dom'
Expand Down Expand Up @@ -354,6 +354,16 @@ describe('manager', () => {
expect(isInViewerPodMock).not.toHaveBeenCalled()
})

it('removes the solo access-denied message when it is closed', () => {
const errorState = document.createElement('solid-ui-error-state')
document.body.appendChild(errorState)
dismissErrorStateOnClose(errorState)

errorState.dispatchEvent(new CustomEvent('close', { bubbles: true, composed: true }))

expect(document.body.contains(errorState)).toBe(false)
})

it('renders pane and header before menu icons resolve', async () => {
let resolveIcon!: (icon: string) => void
const icon = new Promise<string>(resolve => { resolveIcon = resolve })
Expand Down
Loading