mirror of
https://github.com/stablyai/orca.git
synced 2026-10-20 16:03:20 +00:00
Verify ordinary errors bypass lazy chunk containment
Add test ensuring module evaluation bugs still surface despite never-landed reload attempts. Clarify containment scope: recovery only applies to known dynamic-import failures, not ordinary errors.
This commit is contained in:
@@ -50,8 +50,7 @@ export class RecoverableRenderErrorBoundary extends React.Component<Props, State
|
||||
return
|
||||
}
|
||||
if (isLazyChunkLoadError(error)) {
|
||||
// Contained by this fallback; lazy-with-retry already recorded the chunk
|
||||
// error, its call site, and the recovery outcome as a breadcrumb.
|
||||
// Contained by this fallback; recovery breadcrumbs live on the load path.
|
||||
return
|
||||
}
|
||||
void reportReactErrorBoundaryCrash({
|
||||
|
||||
@@ -128,4 +128,17 @@ describe('loadLazyWithRetry when the recovery reload never lands', () => {
|
||||
expect(isLazyChunkLoadError(await settled)).toBe(true)
|
||||
expect(window.sessionStorage.getItem(RELOAD_GUARD_KEY)).toBeNull()
|
||||
})
|
||||
|
||||
it('still surfaces ordinary evaluation bugs after a never-landed reload attempt', async () => {
|
||||
const error = new Error('render bug from lazy module evaluation')
|
||||
const settled = loadLazyWithRetry(() => Promise.reject(error), { retries: 0 }).catch(
|
||||
(rejection: unknown) => rejection
|
||||
)
|
||||
await vi.advanceTimersByTimeAsync(0)
|
||||
await vi.advanceTimersByTimeAsync(RELOAD_SETTLE_GRACE_MS + 1)
|
||||
|
||||
// Containment is only for known dynamic-import failures; real bugs must still report.
|
||||
expect(await settled).toBe(error)
|
||||
expect(isLazyChunkLoadError(error)).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -228,7 +228,7 @@ export async function loadLazyWithRetry<T extends AnyComponent>(
|
||||
// A sibling failing under a pending reload must not clear the guard, and an
|
||||
// unrelated failure must not clear a guard it did not set.
|
||||
if (!reloadRequestInFlight && isKnownDynamicImportFailure(lastError)) {
|
||||
// Record the veto beside the resulting report before the ring can evict it.
|
||||
// Record the veto before the ring can evict it; the failure is then contained.
|
||||
clearChunkReloadGuard()
|
||||
recordReloadBreadcrumb(
|
||||
'lazy_chunk_reload_vetoed',
|
||||
|
||||
Reference in New Issue
Block a user