motiondivision / motiondivision/motion
[BUG] layoutId cannot be changed?
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 33.7k
- Forks
- 1.4k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 14
Description
** Describe the bug**
I have noticed that motion component behave as the layoutId provided to them on the first render remains the same forever, even though its passed value changes.
IMPORTANT: Provide a CodeSandbox reproduction of the bug
If this is something that is not intended, I will try to reproduce it in sandbox
Steps to reproduce
Steps to reproduce the behavior:
- Initialize a state as undefined(or some string) and on the first render give it a different value.
- Pass this variable as the layoutId in your motion component.
- Try to transition to a different component with its layoutId being the second value.
- The transition does not work.
Expected behavior
layoudId should update when passed a new value.
I'm currently setting the layoutId of an image gallery component(to the url of the image) so it would transition to the page with that same image (the image in the page has the correct layoutId). It only works for the first image of the gallery, while the others "snap" to position. If I were to add the layoutId to each image instead of the gallery itself, I would get weird behaviour with AnimatePresence since the images repeat themselves like in the example in the docs.
I would love some feedback on how layoutId works since I cannot find anything else in the docs and it is always used with a constant string like "underline". Are constant values the only ones that are acceptable?
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
The issue names no files, tests, or entry points; begin by reproducing the described state change with a motion component and an image gallery using layoutId. Compare the first-render value with later values and verify that changing layoutId enables the expected transition without the reported snapping or AnimatePresence behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100