Backtestsvuerun-20261009-161443#7506
suspense.resolve() is called without a pending branch.
The harness couldn't finish this ticket.
The solver hit its turn or time cap.. No judgment was produced for this ticket. It counts as an error in the run total.
Solve
1h 30m
Wall-clock time in the container
Full test suite
Not run
The harness did not reach the test stage
Contamination audit
Clean
No sign the agent saw the real fix
Patch size
0vs 141 merged
Changed lines, ours vs merged
The issue
View on GitHubVue version
3.2.45
Link to minimal reproduction
https://codesandbox.io/s/vue-router-playground-forked-w9164p?file=/src/pages/Page2.vue
Steps to reproduce
Create an application with vue and vue-router and the suspense component.
When creating a page, during the setup function navigate to another page (in my case this is how I handle an error) than this error is triggered.
What is expected?
Just no error message from vue / Suspense.
What is actually happening?
I get the following error message:
`
suspense.resolve() is called without a pending branch.
`
Nevertheless I can keep on using the application without any problems. I just want to get rid of the error message.
System Info
_No response_
Any additional comments?
_No response_
The two patches
No patch was produced.packages/runtime-core/__tests__/components/Suspense.spec.tsindex 6b6373fab..68d71ebd1 100644@@ -2004,6 +2004,143 @@ describe('Suspense', () => { ]) }) + // toggling a nested suspensible suspense to sync content resolves the+ // parent boundary synchronously while it is still being patched; the+ // fallback fall-through must then be skipped or it patches the unmounted+ // fallback and corrupts activeBranch+ test('nested suspensible suspense toggled to sync content while parent is in fallback', async () => {+ const route = ref('a')+ const label = ref('first')++ const AsyncChild = {+ async setup() {+ await new Promise(() => {}) // never resolves+ return () => h('div', 'async child')+ },+ }+ const PageA = {+ setup: () => () => h('div', [h('span', 'page a'), h(AsyncChild)]),+ }+ const PageB = {+ setup: () => () => h('div', `page b ${label.value}`),+ }++ const Comp = {+ setup() {+ return () =>+ h(Suspense, null, {+ default: h('div', { 'data-label': label.value }, [+ h(+ Suspense,+ { suspensible: true },+ {+ default:+ route.value === 'a'+ ? h(PageA, { key: 'a' })+ : h(PageB, { key: 'b' }),+ },+ ),+ ]),+ fallback: h('div', 'fallback'),+ })+ },+ }++ const root = nodeOps.createElement('div')+ render(h(Comp), root)+ expect(serializeInner(root)).toBe(`<div>fallback</div>`)++ // the nested suspense resolves synchronously, propagates, and resolves+ // the outer boundary mid-patch+ route.value = 'b'+ await nextTick()+ expect(serializeInner(root)).toBe(+ `<div data-label="first"><div>page b first</div></div>`,+ )++ // a follow-up update must still reach the DOM+ label.value = 'second'+ await nextTick()+ expect(serializeInner(root)).toBe(+ `<div data-label="second"><div>page b second</div></div>`,+ )+ })++ // a nested suspensible suspense resolving synchronously inside the parent's+ // same-root patch must not resolve the parent before later siblings in the+ // same patch have registered their async deps+ test('nested suspensible suspense resolving the parent mid-patch while a later sibling registers an async dep', async () => {+ const route = ref('a')+ const show = ref(false)+ let releaseSibling: () => void+ const siblingGate = new Promise<void>(r => (releaseSibling = r))++ const NeverChild = {+ async setup() {+ await new Promise(() => {}) // never resolves+ return () => h('div', 'never')+ },+ }+ const Sibling = {+ async setup() {+ await siblingGate+ return () => h('div', 'sibling')+ },+ }+ const PageA = {+ setup: () => () => h('div', [h('span', 'page a'), h(NeverChild)]),+ }+ const PageB = {+ setup: () => () => h('div', 'page b'),+ }++ const onResolve = vi.fn()+ const Comp = {+ setup() {+ return () =>+ h(+ Suspense,+ { onResolve },+ {+ default: h('div', [+ h(+ Suspense,+ { suspensible: true },+ {+ default:+ route.value === 'a'+ ? h(PageA, { key: 'a' })+ : h(PageB, { key: 'b' }),+ },+ ),+ show.value ? h(Sibling) : null,+ ]),+ fallback: h('div', 'fallback'),+ },+ )+ },+ }++ const root = nodeOps.createElement('div')+ render(h(Comp), root)+ expect(serializeInner(root)).toBe(`<div>fallback</div>`)++ // the nested suspense resolves synchronously and releases the parent's+ // last dep, but the sibling mounted right after it is still pending+ route.value = 'b'+ show.value = true+ await nextTick()+ expect(serializeInner(root)).toBe(`<div>fallback</div>`)+ expect(onResolve).not.toHaveBeenCalled()++ releaseSibling!()+ await new Promise(r => setTimeout(r))+ expect(serializeInner(root)).toBe(+ `<div><div>page b</div><div>sibling</div></div>`,+ )+ expect(onResolve).toHaveBeenCalledTimes(1)+ })+ // #6416 test('KeepAlive with Suspense', async () => { const Async = defineAsyncComponent({packages/runtime-core/src/components/Suspense.tsindex 8a186fff2..ba61c6340 100644@@ -246,6 +246,9 @@ function patchSuspense( suspense.pendingBranch = newBranch if (isSameVNodeType(pendingBranch, newBranch)) { // same root type but content may have changed.+ // hold the boundary pending across the patch: a nested branch that+ // resolves in here must not resolve it before later siblings register.+ suspense.deps++ patch( pendingBranch, newBranch,@@ -258,6 +261,7 @@ function patchSuspense( slotScopeIds, optimized, )+ suspense.deps-- if (suspense.deps <= 0) { suspense.resolve() } else if (isInFallback) {