fix(editor): honest stopped state when the draft is unsaved; no dead retry
0279953 chose the stopped message from CoreRuntime.stopped alone: it
promised the report was kept even when the tab's storage refused the
draft (export, the banner's advice, needs the core), four surfaces still
offered a retry that could not work, and a failed recovery below the cap
was a dead end since nothing called retry().
The runtime restarts a failed recovery on the next call (compiled module
reused, cap still counts traps) and notifies status listeners. One
CoreStoppedNotice on the editor, Home, New report and the full-page
notice: reload when saved, else core.stopped_unsaved with a core-free
copy download (also on the storage-full banner) and a beforeunload
guard. Export, import and new report say the stopped message; a core
failure reading an unread draft is FAILED, not held. ESLint census of
the failure keys; core.stopped says "plusieurs erreurs".
This commit is contained in:
1 parent
0279953e9e
commit
6371523f8c
24 files changed
+839
-83
No files matched your search
@@ -211,3 +211,32 @@ describe('HomeRoute import: size gate', () => {
|
||||
expect(useReportStore.getState().report).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
describe('HomeRoute import: a core failure reading the tab draft', () => {
|
||||
it('shows the engine error line, not the held-session alert', async () => {
|
||||
importMock.mockReturnValue(outcome({ migrated: false }))
|
||||
const real = useReportStore.getState().hydrateImport
|
||||
useReportStore.setState({ hydrateImport: () => ({ ok: false }) })
|
||||
try {
|
||||
await mountAndPickPdf()
|
||||
await screen.findByText(fr['home.import.error_core_unavailable']!)
|
||||
expect(alertMock()).not.toHaveBeenCalled()
|
||||
expect(screen.queryByTestId('editor-route')).toBeNull()
|
||||
} finally {
|
||||
useReportStore.setState({ hydrateImport: real })
|
||||
}
|
||||
})
|
||||
|
||||
it('still alerts and opens the editor for a held session text', async () => {
|
||||
importMock.mockReturnValue(outcome({ migrated: false }))
|
||||
const real = useReportStore.getState().hydrateImport
|
||||
useReportStore.setState({ hydrateImport: () => ({ ok: false, reason: 'held' }) })
|
||||
try {
|
||||
await mountAndPickPdf()
|
||||
await screen.findByTestId('editor-route')
|
||||
expect(alertMock()).toHaveBeenCalledWith(fr['session.held_blocked'])
|
||||
} finally {
|
||||
useReportStore.setState({ hydrateImport: real })
|
||||
}
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user