mirror of
https://github.com/stablyai/orca.git
synced 2026-11-01 17:47:40 +00:00
fix(app-shell): let users close the profile storage delay warning (#28900)
The warning sticks until profile saving catches up, but it turned off the close button every other Orca toast gets from the app toaster.
This commit is contained in:
@@ -11,9 +11,9 @@ const title = 'Profile storage is taking longer than usual'
|
||||
const frames: FrameRequestCallback[] = []
|
||||
const listeners = new Set<(delayed: boolean) => void>()
|
||||
|
||||
function Notice() {
|
||||
function Notice({ closeButton = false }: { closeButton?: boolean }) {
|
||||
useProfileStateSaveDelayNotice()
|
||||
return <Toaster />
|
||||
return <Toaster closeButton={closeButton} />
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -97,6 +97,16 @@ it('does not let StrictMode cleanup dismiss the initial delayed snapshot', async
|
||||
expect(view.queryAllByText(title)).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('lets the user close the warning with the app toaster close button', async () => {
|
||||
const view = render(<Notice closeButton />)
|
||||
await advanceTimers()
|
||||
expect(view.queryByText(title)).not.toBeNull()
|
||||
|
||||
act(() => view.getByRole('button', { name: 'Close toast' }).click())
|
||||
await finishDismissal()
|
||||
expect(view.queryByText(title)).toBeNull()
|
||||
})
|
||||
|
||||
it('keeps a new warning if recovery and another delay arrive before a dismissal frame', async () => {
|
||||
const view = render(<Notice />)
|
||||
await advanceTimers()
|
||||
|
||||
@@ -62,9 +62,7 @@ it('restores a persistent warning from main and clears it on completion', async
|
||||
{
|
||||
id: undefined,
|
||||
description: 'Further saves may be delayed while this operation finishes.',
|
||||
duration: Infinity,
|
||||
dismissible: false,
|
||||
closeButton: false
|
||||
duration: Infinity
|
||||
}
|
||||
)
|
||||
publish(false)
|
||||
|
||||
@@ -34,9 +34,7 @@ export function useProfileStateSaveDelayNotice(): void {
|
||||
'app.saving.delayedDescription',
|
||||
'Further saves may be delayed while this operation finishes.'
|
||||
),
|
||||
duration: Infinity,
|
||||
dismissible: false,
|
||||
closeButton: false
|
||||
duration: Infinity
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user