Repository navigation
Conversation
When a new component is inserted because no matching host was found, the vnode at the cursor is an unrelated sibling, not a host being replaced. Clearing its effects dropped the sibling's signal bindings, so its attributes stopped updating. Fixes QwikDev#9189
🦋 Changeset detectedLatest commit: def81f4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is it?
Description
Fixes #9189.
Once a conditional component has been rendered in front of an element, that element's signal-bound attributes stop updating:
After "Card declined" shows the
<Alert>, later changes tobusyno longer reach the button'sclass/aria-busy.The attributes are lost when the
<Alert>is inserted, not when it is removed. The issue sees it on the next click, because that is the firstbusychange afterwards.Cause: in
expectComponent, whenmoveOrCreateKeyedNodefinds no host for the component,insertNewComponent(diffContext, host, ...)is called withhost = vNewNode || vCurrent. In that branchhostis just the vnode at the cursor, here the<button>. It is not a component being replaced.insertNewComponentrunsclearAllEffectson it, which removes the button's subscriptions tobusy. The two otherinsertNewComponentcalls do replacehost(same key but a different component, or props changed without a key), and clearing there is intended.Fix: pass
nullfrom themoveOrCreateKeyedNodebranch. The vnode left at the cursor is either matched by a later JSX node, so it must keep its effects, or removed byexpectNoMore/cleanupSideBuffer, which already runcleanupand clear its effects.Test:
render-regression.spec.tsx>issue #9189follows the issue's steps for bothssrRenderToDomanddomRender: pay, decline (Alert appears), pay again. The last step expectsclass="pay busy"andaria-busy="true".Commands run (Node 22,
pnpm build.core.devfirst):pnpm vitest run packages/qwik/src/core/tests/render-regression.spec.tsx -t "9189": 2 failed (expected 'pay' to be 'pay busy') with the fix reverted; 2 passed with it.pnpm vitest run packages/: 3854 passed, 7 failed. The 7 failures are all inqwik-vite/src/plugins/plugin.unit.tsand also fail onmainin this environment (Cannot find module .../bindings/qwik.wasm.mjs, no Rust/WASM build). Onmainthe same run gives 3852 passed, 7 failed. Packages whose dependencies were not installed (devtools, docs, mcp, browser-extension) fail to import in both runs.pnpm test.e2e.chromium(dev build): 580 passed, 1 failed, 2 skipped, 1 did not run. The failure isssg-snapshot.e2e.ts› "core chunk brotli size stays within budget". It also fails onmainwith the dev build (36783 bytes onmain, 36755 on this branch, budget 34800). The test itself says it expects the production build, which was not built here.prettier --checkandeslinton the changed files: clean.Not run:
pnpm build.core/api.update(no public API change), the Rust optimizer, the e2e suites withQWIK_OPTIMIZER=rust, the production build for the brotli budget check.Checklist
pnpm change