Skip to content

fix(renderer): keep component Fragments structurally transparent - #158

Merged
smiggleworth merged 1 commit into
mainfrom
fix/transparent-component-fragments
Jul 27, 2026
Merged

fix(renderer): keep component Fragments structurally transparent#158
smiggleworth merged 1 commit into
mainfrom
fix/transparent-component-fragments

Conversation

@smiggleworth

Copy link
Copy Markdown
Contributor

Summary

  • materialize plain component-returned Fragments as internal detached ranges instead of visible div wrapper hosts
  • reconcile Fragment range interiors transactionally across scheduled updates and parent-driven sync while preserving DOM identity, focus, selection, and rollback behavior
  • cover direct sibling topology, updates, removal cleanup, and SSR hydration adoption
  • document the Fragment topology contract and bump the package to 0.0.77

Fixes #157

Red to green

Before the renderer change, the new direct-sibling regression expected SECTION, DIV, MAIN but received DIV, MAIN because the component result was wrapped in an implementation div.

The first transparent-range implementation exposed four existing identity and rollback regressions in the full jsdom suite. The final transactional range reconciliation keeps those tests green as well as the new regression.

Validation

  • npm run fmt -- --check
  • npm run check
    • 35 contract checks
    • 151 unit tests
    • 1,259 jsdom tests
    • 40 browser tests
    • build, lint, type, publint, installed-package, and pack artifact gates
  • npm run bench
    • Tier 1 through Tier 4 completed successfully

Copilot AI review requested due to automatic review settings July 27, 2026 17:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the renderer so that when a plain component returns a Fragment, the Fragment remains structurally transparent (no visible wrapper host is inserted) across SPA rendering, scheduled updates, parent-driven reconciliation, and SSR hydration.

Changes:

  • Add transactional reconciliation for component-owned Fragment ranges to preserve DOM identity, focus/selection, and rollback semantics.
  • Stop materializing multi-node component results via an implementation div when the result is a Fragment.
  • Add jsdom regressions for sibling topology (including hydration) and document the Fragment topology contract; bump package version to 0.0.77.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/jsdom/ssr/hydration.test.tsx Adds hydration regression ensuring component-returned Fragment siblings preserve direct-child topology and identity.
tests/jsdom/dom/component-fragment-structure.test.tsx Adds DOM regression covering updates/removal cleanup for transparent component Fragment siblings.
src/renderer/component-range-commit.ts Routes component range replacement through Fragment range sync before materializing wrapper hosts.
src/renderer/component-host.ts Enables Fragment range sync when an existing component host is a comment-anchored range.
src/renderer/component-host-results.ts Prevents Fragment component results from being wrapped in an implementation div.
src/renderer/component-fragment-range.ts Introduces transactional range reconciliation for component-returned Fragments.
package.json Bumps @askrjs/askr version to 0.0.77.
package-lock.json Updates lockfile version fields to 0.0.77.
docs/guides/platform-recipes.md Updates the “verified against” version contract to 0.0.77.
docs/guides/component-generation.md Documents guidance around using Fragments for multiple direct siblings (and avoiding wrapper elements).
docs/core/rendering.md Documents the component Fragment topology contract and internal comment-anchored range behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/renderer/component-fragment-range.ts

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.

Comment thread src/renderer/component-fragment-range.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.

Comment thread tests/jsdom/dom/component-fragment-structure.test.tsx

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.

Comment thread src/renderer/component-host-results.ts

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 20 changed files in this pull request and generated 2 comments.

Comment thread src/renderer/component-fragment-range.ts
Comment thread src/renderer/component-fragment-range.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 20 changed files in this pull request and generated no new comments.

@smiggleworth
smiggleworth merged commit 76e4096 into main Jul 27, 2026
4 checks passed
@smiggleworth
smiggleworth deleted the fix/transparent-component-fragments branch July 27, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keep plain component Fragment results transparent during client render and hydration

2 participants