[system] Resolve InitColorSchemeScript %s placeholder at build time - #49113
Draft
Janpot wants to merge 1 commit into
Draft
[system] Resolve InitColorSchemeScript %s placeholder at build time#49113Janpot wants to merge 1 commit into
Janpot wants to merge 1 commit into
Conversation
Deploy previewBundle size
Check out the code infra dashboard for more information about this PR. |
Janpot
force-pushed
the
refactor-init-color-scheme-placeholders
branch
from
September 8, 2026 13:36
ecad100 to
30dbb06
Compare
12 tasks
buildInitColorSchemeScript emitted `'mode-%s'.replace('%s', colorScheme)`
into the inline script and substituted the scheme at runtime in the
browser. Parse the template once at build time instead and emit plain
string concatenation (`"mode-" + colorScheme`), so the `%s` placeholder
and the runtime `.replace` no longer reach the generated script.
Also fixes a latent bug where a class-form attribute (e.g. `.mode-%s`)
additionally emitted an invalid `setAttribute('.mode-%s', ...)` call that
threw on every render (swallowed by the inline try/catch).
Janpot
force-pushed
the
refactor-init-color-scheme-placeholders
branch
from
September 9, 2026 09:52
30dbb06 to
5fb96f2
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.
Resolve the
%splaceholder at build time instead of shipping it into the browser:'mode-%s'.replace('%s', colorScheme)becomes"mode-" + colorScheme. No behavior change for any documentedattributeshape.The intended benefit is for what comes next: every static segment now flows through a single serialization point, so once #49091 lands (it adds the escaping helper for the storage keys / scheme defaults), applying that same escaping to the
attribute/selector parts is a one-line swap rather than reworking the runtime.replace.Also fixes a latent bug where a class-form attribute (
.mode-%s) additionally emitted an invalidsetAttribute('.mode-%s', …)that threw on every render (swallowed by the inline try/catch).