Repository navigation
fix(core): render async dangerouslySetInnerHTML as content in client render - #9194
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 1b6a280 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 |
@qwik.dev/core
@qwik.dev/router
@qwik.dev/utils
eslint-plugin-qwik
create-qwik
@qwik.dev/optimizer
@qwik.dev/devtools
@qwik.dev/mcp
commit: |
…render When a const attribute's value was still a promise at element creation, the resolved value was always set as an attribute, so dangerouslySetInnerHTML from a useComputed$ ended up as a literal attribute and the element stayed empty. Route it through the same inner-HTML handling as the sync path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
intellix
force-pushed
the
fix/async-inner-html
branch
from
October 9, 2026 16:40
9682392 to
1b6a280
Compare
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
In client render,
dangerouslySetInnerHTMLbound to auseComputed$is written as a literal attribute, and the element stays empty:A
useSignalvalue or a plain string works. It only happens when the value is still a promise as the element is created, for example auseComputed$whose QRL hasn't loaded yet, or an async computed. We hit it on a loading spinner whose SVG came from auseComputed$: every client-rendered spinner was blank, so a page that renders its loading state client-side looked empty until its data arrived.Reproduction
Open in the playground
Click the button: no bold text appears, and
#targetcarries adangerouslysetinnerhtmlattribute instead of the HTML as content.Cause and fix
When creating an element, a const attribute whose value is a promise goes through
queueConstAttributePromise, which always callsdirectSetAttributeonce the promise resolves. The synchronous path right below it sendsdangerouslySetInnerHTMLtoapplyConstInnerHtmlinstead. The fix sends the resolved value through that same helper:The rest of the diff is Prettier re-indenting the existing call.
Not covered: SSR
SSR has a similar problem. A promise-valued attribute is written later by the backpatch, which only sets attributes, so
dangerouslySetInnerHTMLfrom an async computed is server-rendered as an attribute too. Fixing that means teaching the backpatch to set inner HTML, which is a bigger change, so I've left it out of this PR to keep it small. I'm happy to open an issue or follow-up for it.Tests
A new test in
client-render.spec.tsxrendersdangerouslySetInnerHTMLfrom an async computed and checks the HTML is the element's content, not an attribute. It fails onmain(expected '' to be '<b>async</b>') and passes with the fix. The fullpackages/qwik/src/coresuite passes (2395 tests).Checklist
pnpm change