Skip to content

Respect the app's Next config; observe only layout changes - #40

Merged
uiwwsw merged 1 commit into
mainfrom
perf/next-friendly
Nov 26, 2026
Merged

uiwwsw merged 1 commit into
mainfrom
perf/next-friendly

Conversation

@uiwwsw

@uiwwsw uiwwsw commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Findings from reviewing Next.js fit and performance against SSGOI:

  • withStackflow overwrote an explicit cacheComponents: false. Now defaults only. Production build without Cache Components: push and Back animate, scroll restores (900 → 900), only state resets.
  • MutationObservers now filter to layout attributes: 30 aria/data-state toggles went from 90+90 layout/style reads to 0+0 (measured in a production build).
  • Style writes skipped when unchanged; scroll capture reads only scrollTop.
  • README: Next.js compatibility section with measured bundle sizes (ours 31.5 KB gz all exports vs @ssgoi/react + view-transitions 44.0 KB).

Not changed (measured fine): useSearchParams is inside Suspense (no CSR bailout); StackLink keeps next/link prefetch; per-navigation DOM clone for swipe preview costs ~1.6 ms for 15k nodes.

npm test 63 pass, check, build.

🤖 Generated with Claude Code

- withStackflow sets cacheComponents and partialPrefetching only when the
  app's config leaves them unset. It used to overwrite an explicit false,
  forcing a Cache Components migration. A production build without them
  still animates push and Back and restores scroll; only screen state
  resets, as in plain Next.js.
- The track observers watch class, style, hidden and
  data-stackflow-fixed-key only. Thirty aria-pressed/data-state toggles
  caused 90 getBoundingClientRect and 90 getComputedStyle calls; now 0.
- The track writes styles only when a value changes.
- Scroll capture reads only scrollTop on each scroll event; the range is
  clamped by the browser on restore.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
stackflow-next Ready Ready Preview Nov 26, 2026 2:29am UTC

@uiwwsw
uiwwsw merged commit dce9d88 into main Nov 26, 2026
4 checks passed
@uiwwsw
uiwwsw deleted the perf/next-friendly branch November 26, 2026 02:29
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.

1 participant