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 .changeset/surface-resume-failures.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@qwik.dev/core': patch
---

fix: surface a failed container resume — report it and unblock `whenContainerDataReady` waiters — instead of swallowing the error into a silent hang.
6 changes: 4 additions & 2 deletions packages/qwik/src/core/client/process-state-data.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { type DomContainer } from './dom-container';
import { onVNodeDataReady } from './process-vnode-data';
import { logError } from '../shared/utils/log';
import {
createYieldingIteratorState,
scheduleYieldingIterator,
Expand Down Expand Up @@ -91,9 +92,10 @@ function scheduleProcessContainerStateData(
state.$active$ = null;
scheduleProcessContainerStateData(container, state);
},
() => {
(error) => {
state.$active$ = null;
container.$containerDataProcessState$ = ContainerDataProcessState.ProcessingStateDone;
logError(error);
markContainerDataReady(container);
}
);
scheduleYieldingIterator(state.$active$);
Expand Down
22 changes: 22 additions & 0 deletions packages/qwik/src/core/client/process-state-data.unit.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { describe, expect, it } from 'vitest';
import { domRender } from '@qwik.dev/core/testing';
import type { DomContainer } from './dom-container';
import { processContainerStateData, whenContainerDataReady } from './process-state-data';

describe('container state-data resume errors', () => {
it('a resume error unblocks whenContainerDataReady instead of hanging silently', async () => {
const { container } = await domRender(<div id="ok">ok</div>);

// Drive the container-state pipeline with a throwing iterator
processContainerStateData(
container as unknown as DomContainer,
(function* () {
yield;
throw new Error('resume boom');
})()
);

await whenContainerDataReady(container as unknown as DomContainer, () => undefined);
expect(true).toBe(true);
});
});
Loading