Repository navigation
perf: lazy-load Motion and fix React Doctor findings (CHAT-46) - #91
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Oct 12, 2026
Motion's animation engine shipped in every route's first load. The app now uses `m.*` from motion/react-m inside one strict LazyMotion provider that loads domMax on demand from lib/motion-features.ts, cutting ~24 kB gzipped from the playground and docs first-load JS. Strict mode makes a stray `motion.*` throw instead of quietly pulling the engine back in, and MotionConfig reducedMotion="user" snaps the remaining height reveals. Fixes from a React Doctor review (23 errors / 66 warnings -> 18 / 57; the rest are triaged as intentional or false positives): - Refs are no longer written during render where React may discard it. AskUser mirrors its latest highlight and register callback in insertion effects, which run before the options' own layout effects that seed the highlight. Composer.Command's closing flag and the playground's ask-user panel cache are state that changes only when they flip. - AskUser, the shared collapsible (Reasoning, Steps), the anchored Tabs surface and SidebarViews memoize their context values. - The playground builds its seen-messages set once instead of per stream chunk, the steps chevron transitions only opacity and rotate, and the docs search input gets an accessible name. - The playground mints its chat id with a lazy useState initializer: useMemo may recompute, which would swap the chat out from under the user. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rpvilo
force-pushed
the
perf/lazy-motion
branch
from
October 14, 2026 18:03
24d5eb2 to
79753c0
Compare
Contributor
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
This branch was successfully deployed
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.
Resolves CHAT-46.
Lazy-load Motion (app)
m.*frommotion/react-minside one strictLazyMotionprovider (components/providers.tsx). It loadsdomMaxon demand fromlib/motion-features.ts;domMaxrather thandomAnimation, because attachment chips uselayout.strictmakes a straymotion.*throw instead of quietly pulling the engine back into the first load.MotionConfig reducedMotion="user"snaps the remaining height reveals under reduced motion.React Doctor fixes
Full scan (
react-doctor . --no-score --no-supply-chain): 23 errors / 66 warnings → 18 / 57.Fixed:
no-ref-current-in-render, 5 of 10):AskUser.OptionsandAskUser.Optionmirror their latest values in insertion effects. These run before the options' own layout effects, which seed the initial highlight; a layout-effect mirror would overwrite that seed withnull.Composer.Command's closing flag and the playground's ask-user panel cache are now state that changes only when they flip.AskUser×3, the shared collapsible (Reasoning,Steps), the anchoredTabssurface,SidebarViews.opacityandrotate(checked: Tailwind v4'srotate-180compiles to therotateproperty)aria-labeluseStateinitializer.useMemomay recompute, which would swap the chat out from under the user.Left as is, triaged:
useRenderElement's conditional hooks (3): the same intentional pattern as Base UIexhaustive-deps(8)Testing
packages/chat: typecheck and 518 tests pass, including the ask-user a11y suite.Notes
components/chat.tsx,components/playground-settings.tsxandcomponents/ai/thread.tsx. Inchat.tsxboth edit the samemotion/reactimport line, so whichever merges second resolves a small, mechanical conflict.doctorscript inpackage.json,.github/workflows/react-doctor.yml). It's still undecided; see CHAT-46.🤖 Generated with Claude Code
Summary by CodeRabbit