Repository navigation
perf(octane): stop bundling FragmentInstance for Activity-only consumers - #1802
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue. You can view the agent here.
Reviewed by Cursor Bugbot for commit 9becbaa. Configure here.
Benchmark report🟢 No budget breaches, no added work, and no timing changes beyond ±3%. Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
All 64 work counters are unchanged. Application bundle size (bytes)
54 other measured values are unchanged. Public-import reachability bundles (bytes)No changes across 105 measured values. |
Resolve the budget conflicts against main after #1784: take main's budgets and lower the 28 values this branch now measures below them (min(main, measured + headroom)); none is raised. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve the budget conflicts against main after #1792 re-cut every budget for Vite's oxc minifier: take main's budgets and lower the values this branch now measures below them (min(main, measured + headroom)); none is raised. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Take #1811's budgets: its todo raw raise matches this branch's measurement, and its deferred-hydration row is kept as main has it so #1803 still fits. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Take main's budgets after #1803. Re-recording with this branch's runtime ratchets every value to main's (#1803 already cut them to measured + headroom), and deferred-hydration keeps main's row. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
🚀 Deploying Preview to Cloudflare 🚀Preview Deployments by commit
|

Summary
<Activity>consumers no longer bundle theFragmentInstanceclass unless a<Fragment ref>is used. Revealing an Activity now recognises Fragment refs by membership of the existingactiveFragmentsregistry instead ofinstanceof FragmentInstance.Why
queueCurrentActivityRefsusedinstanceof FragmentInstance, which keeps the constructor and its traversal, listener, and focus machinery reachable in every bundle that reaches the Activity reveal path.FragmentInstancealready registers itself inactiveFragments(constructor) and removes itself on_destroy, so membership is an exact equivalent for live instances without referencing the class.Bytes (esbuild 0.28.1 probe from #1789, browser ESM, minify, production, gzip -9, on
8aeb6c0e5)__createVoidRoot, activityBlockcreateRoothydrateRootNo committed
run-minimal.mjsorrun.mjsscenario compiles an<Activity>without a Fragment ref, so committed budgets do not move beyond noise: re-recorded against current main, 8 entries move down by 1–8 bytes and none rises (budget-raises.mjs --base origin/main). A same-base A/B ofdeferred-hydration,prop-attributes,contextandbinding-radix-viteis byte-identical with and without the change. An earlier revision of this description attributed a larger budget drop to this PR; that drop came from #1781 landing on main and is not part of this change.Changes
packages/octane/src/runtime.ts: one-line change inqueueCurrentActivityRefs.fragment-refs-activity.test.ts: regression test. A Fragment callback ref revealed by Activity must see child ownership published (reactFragments) when it runs, which only happens through theattachLiveFragmentReftrampoline. The existing suite stayed green when the routing was removed, so it did not pin this; the new test fails without it ([false]vs[true]) and passes with it.--write-budgets(noise-level only, see above); changeset added.Validation
pnpm typecheck(exit 0)pnpm vitest run --project octane --project octane-prod: 41,520 passed. The 15 failures were inbehavior-root,hydration-ssr-diagnosticsandcompiler/volar(timeouts under full-suite load). Rerun in isolation, those 3 files pass 334/334 both with and without this change.node benchmarks/bundle-size/run-minimal.mjs --budgetsandrun.mjs --budgets octane-tsrx octane-jsxholdpnpm sync,pnpm format:files:checkpnpm test(left to CI)Risk / follow-ups
FragmentInstancethat was destroyed but still appears in a visible manifest would now be routed as a plain ref. Destroyed instances are removed from scope cleanups in the same pass, so this should not occur; the conformance suite covers reveal after hide, nested Activity and portals.Provenance
agent-authored)Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Touches Activity reveal ref attachment in the runtime; behavior should match live Fragment instances via the existing registry, but stale registry entries could theoretically mis-route refs.
Overview
Apps that use
<Activity>without<Fragment ref>no longer pull in theFragmentInstanceimplementation. When an Activity reveals,queueCurrentActivityRefsnow picks the live Fragment ref trampoline viaactiveFragments.has(entry.el)instead ofinstanceof FragmentInstance, so minifiers can drop the class unless Fragment refs are actually used.A conformance test asserts that revealing a hidden Activity runs Fragment callback refs only after
attachLiveFragmentRefhas published child ownership onreactFragments, guarding the routing change. A patch changeset documents the bundle-size fix.Reviewed by Cursor Bugbot for commit 3a0a4ec. Bugbot is set up for automated code reviews on this repo. Configure here.