motiondivision / motiondivision/motion
[BUG] Using `layoutRoot` on the parent causes degradation of performance in `Reorder` component
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 33.7k
- Forks
- 1.4k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 14
Description
1. Read the FAQs 👇
✅
2. Describe the bug
Using layoutRoot on the parent causes degradation of performance in Reorder component.
3. IMPORTANT: Provide a CodeSandbox reproduction of the bug
https://codesandbox.io/p/sandbox/framer-motion-variants-forked-kwqsnd?file=%2Fsrc%2FApp.tsx
4. Steps to reproduce
Steps to reproduce the behavior:
- Create a parent with
openandclosedvariants with different scales. - Create a
Reorder.GroupwithlayoutandlayoutRootproperties. - Create a few
Reorder.Item. - Toggle the parent's variant and observe the
Reorder.Groupcorrectly follow the parent. - Reorder the
Reorder.Itemand observe degradation in performance and jittery motion.
5. Expected behavior
Adding layoutRoot should not affect the performance of the Reorder component. If layout is causing the issue, it would be good to be able to set only layoutRoot without layout.
6. Video or screenshots
https://github.com/framer/motion/assets/455178/fe153434-a941-4c28-bec1-36da6517ac8b
7. Environment details
Google Chrome: 119.0.6045.159
MacOS: Sonoma 14.0
Framer-motion: 10.16.5
React: 18.2.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the CodeSandbox reproduction in src/App.tsx and verify the performance difference when reordering with the parent variant and Reorder.Group using layout and layoutRoot. Trace the Reorder component's layout handling, then confirm that toggling the parent and reordering items no longer causes jitter or degradation without regressing the parent transition.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100