Repository navigation
Conversation
95 tasks done
domgan-oai
marked this pull request as ready for review
August 10, 2026 11:11
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.
Summary
use(factory(...))request creators.Part of #673.
Why
Previously, hydration adopted the server result only after evaluating the client-side request factory. That started a duplicate request even though its result was immediately discarded. Independent request creation can also move ahead of
use()consumption, so a positional seed lookup alone can incorrectly claim a context, externally owned promise, or another component occurrence.Changes
use()order, and retain normal request creation when metadata is missing or invalid.Validation
pnpm format:checkpnpm --config.enable-pre-post-scripts=false run typecheck— full workspace typecheck body, including bindings, core typetests, integrations, website, 17 example apps, and benchmarks. The unrelated Solanapretypecheckwas disabled because its dependencies are unavailable in the cached worktree installation.pnpm exec vitest run --project octane --project octane-prod --silent=passed-only— 804 files, 11,657 tests passed.pnpm exec vitest run packages/octane/tests/browser/suspense-hydration/suspense-hydration.test.ts --project octane-events-browser --silent=passed-only— 11 real-browser streamed hydration tests passed../node_modules/.bin/vitest run packages/octane/tests/hydration/suspense-hydrate.test.ts --project octane --project octane-prod --silent=passed-only— fulfilled/rejected seeds, zero request creation, independent sites, existing promises, contexts, external owners, repeated sites, streamed nesting, deferred activation, and dependency invalidation.node benchmarks/bench.mjs --quick async-composition— production browser workload preserved 2 request waves, 8 actual requests per operation, and zero mixed states.node benchmarks/bundle-size/run-minimal.mjs— all production reachability scenarios execute successfully; client-only static/suspense entries shrink against the same-commit baseline.node benchmarks/codegen-size/run.mjs— fixed corpus remains 152,623 raw / 75,339 minified bytes.pnpm changeset:checkpnpm syncpnpm test— full cross-workspace project matrix was not run; the complete Octane development/production matrix and browser hydration project were run instead.Risk / follow-ups
main.Provenance
agent-authored)Note
Medium Risk
Touches SSR seed serialization, client hydration
use()ordering, and compiler codegen for direct async creations; behavior is narrowed to compiler-owned sites but wire-format and hydration edge cases are easy to get wrong.Overview
Fixes hydration starting duplicate client requests when the server already resolved the same compiler-owned
use(call/new)site—the factory used to run before the seed was consumed.The compiler assigns a stable hydration site id to eligible direct creations and wraps client memo callbacks in
seedOrCreate, which returns a lazy thenable tied to that site instead of invoking the factory immediately. Serveruse()records fulfilled/rejected outcomes (or “skipped” markers for context, external owners, and non-owned thenables) into the suspense seed wire format via optionalsitesmetadata on the existing rejection envelope; empty seed arrays no longer emit seed<script>tags.Client hydration decodes site queues,
seedOrCreateconsults them before running factories, anduseSeedkeeps positional seed consumption aligned with ordinaryuse()order—including nested stream, deferredHydrate, and post-hydration prop updates that should refetch.Reviewed by Cursor Bugbot for commit c14b5e1. Bugbot is set up for automated code reviews on this repo. Configure here.