Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 64eb489 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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.
Closes #121.
Summary
Two gaps remained after #76 kept SVG names as written:
vectorEffectwas never mapped tovector-effect. The browser ignored it. On server-rendered pages the HTML parser also lowercased it tovectoreffect, so hydration failed to findvectorEffectand discarded the boundary.attributeName()now hyphenates it.<svg>lost their SVG context. The content was walked with the SVG flag off, which lowercasedpreserveAspectRatio. The<div>placeholder also made the parser break out of the<svg>, and the segment was parsed in an HTML<div>, so the content ended up outside the<svg>in the HTML namespace.For the second gap,
SuspendedBoundarynow records the parent's SVG flag and restores it when the boundary streams. Inside SVG, the placeholder is a<g>and the staging element is<svg style="display:none">. Everywhere else the wire format is unchanged, including inside<foreignObject>. The reveal runtime and client hydration needed no changes because they find both elements by id.Decisions for maintainers
Size budgets. Cost against
main, in gzip bytes:redact/serverredact/dom-client (hydration=stub)scripts/size-check.mjsgets aSVG_CONTEXT_SIZE_ALLOWANCEtable for the amount over budget. It follows the existing allowance tables, and is yours to accept or reject.scripts/test-react-compatibility-size.mjswill fail. I leftcompatibility-size-budget.mjsalone because it records approved growth per baseline. Growth is 5–6 B gzip on client entries and 70 B gzip onserver/index.Overlap with open PRs.
vectorEffect. If it lands first, thevectorchange here can be dropped. This PR does not address SVG presentation attributes (fontSize, stopColor, textAnchor…) reach the DOM in camelCase, so the browser ignores them #81's other props.I read both diffs but did not run either PR.
Testing
New cases in
tests/svg-attribute-casing.test.tsx:vectorEffectthrough SSR, hydration andcreateRoot<svg>, revealed and then hydrated<foreignObject>boundary staying in HTML contextThe
vectorEffectand streamed<svg>cases failed before the fix. The pending-hydration case was added afterwards and was not run againstmain. The<foreignObject>case guards existing behavior and also passed before the fix.pnpm test:typespass on Node 24.21.0. The full suite has one failure on Node 25, inhydration-mismatch-recovery.test.tsx, which also fails onmainand passes with--no-webstorage..nvmrcpins 24.22.0, which I didn't have, so I ran a copy ofsize-check.mjswith the version guard removed on 24.21.0.mainmeasured under budget on that version, with the hydration stub exactly at its limit, but CI on 24.22.0 is the real result.vectorEffectnow applies and hydrates cleanly.<svg>, in the SVG namespace, withpreserveAspectRatiohonored.Known limits
<text>is wrapped in a<g>, which SVG doesn't render there, so that fallback won't show until the reveal.<title>and<desc>inside<svg>are HTML integration points. Boundaries directly inside them still get the SVG treatment, and I didn't test that case.<svg>relies on an inlinestyleattribute, so a strictstyle-srcCSP would block it and leave the content visible until the reveal.