Skip to content

Commit 06159b3

Browse files
committed
Latest
1 parent ed64e5f commit 06159b3

File tree

2 files changed

+38
-12
lines changed

2 files changed

+38
-12
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ Motion adheres to [Semantic Versioning](http://semver.org/).
44

55
Undocumented APIs should be considered internal and may change without warning.
66

7+
## [12.36.0] 2026-03-09
8+
9+
### Added
10+
11+
- Allow `dragSnapToOrigin` to accept `"x"` or `"y"` for per-axis snapping.
12+
713
## [12.35.2] 2026-03-09
814

915
### Fixed

CLAUDE.md

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,26 +95,43 @@ motion (public API)
9595

9696
1. **Create a test page** in `dev/react/src/tests/<test-name>.tsx` exporting a named `App` component. It's automatically available at `?test=<test-name>`.
9797
2. **Create a spec** in `packages/framer-motion/cypress/integration/<test-name>.ts`.
98-
3. **Verify WAAPI acceleration** using `element.getAnimations()` in Cypress `should` callbacks to check that native animations are (or aren't) created.
98+
3. **Verify WAAPI acceleration** using `element.getAnimations()` in Cypress callbacks — but **only for compositor properties** (opacity, transform). `getAnimations()` won't return WAAPI animations for non-compositor properties like height/width in Electron. Don't use it for those.
99+
100+
### Cypress animation testing patterns
101+
102+
- **Use `.then()`, not `.should()`, for mid-animation measurements.** `cy.should()` retries assertions until they pass or timeout — so it will keep retrying until the animation completes, masking bugs where the target value is wrong. `.then()` captures the value at a single point in time.
103+
- **For animation target bugs, use long duration + linear easing + mid-animation measurement.** Set `transition={{ type: "tween", ease: "linear", duration: 10 }}`, wait 5s (50% through), then check the computed style with `.then()`. If the target is wrong, the value will be proportionally wrong and easy to detect.
104+
- **Don't try `getAnimations()` for non-compositor properties** (height, width, etc.) in Cypress/Electron. It likely won't have WAAPI animations to inspect. Stick to computed style checks for these.
105+
- **Don't use `onUpdate` for mid-animation pixel values.** For keyword targets like `"auto"`, `onUpdate` reports the keyword, not the resolved pixel value. Use `getComputedStyle()` instead.
106+
- **Always run Cypress tests in the foreground.** Background bash commands hang silently and produce empty output, making debugging impossible. Cypress needs reliable stdout/stderr.
99107

100108
### Running Cypress tests locally
101109

102110
**You MUST run every new Cypress test against both React 18 and React 19 before creating a PR.** CI runs both and will break if you skip this.
103111

104-
Use the `test-single` pattern from the Makefile, adapted per spec. **Always pick a unique port** using `$RANDOM` to avoid conflicts when multiple agents run tests concurrently:
112+
**Start the Vite dev server directly** — do NOT use `yarn start-server-and-test` with `yarn dev-server` (turbo). Turbo starts ALL dev servers including Next.js, which is slow and unreliable. Starting Vite directly is instant:
105113

106114
```bash
107-
# React 18 — pick a random port, override both Vite and Cypress
115+
# React 18 — start Vite directly, then run Cypress
108116
PORT=$((10000 + RANDOM % 50000))
109-
TEST_PORT=$PORT yarn start-server-and-test "yarn dev-server" http://localhost:$PORT \
110-
"cd packages/framer-motion && cypress run --headed --config baseUrl=http://localhost:$PORT --spec cypress/integration/<test-name>.ts"
111-
112-
# React 19 — same pattern, new random port
117+
cd dev/react && TEST_PORT=$PORT yarn vite --port $PORT &
118+
DEV_PID=$!
119+
# Wait for server to be ready
120+
npx wait-on http://localhost:$PORT
121+
cd packages/framer-motion && cypress run --headed --config baseUrl=http://localhost:$PORT --spec cypress/integration/<test-name>.ts
122+
kill $DEV_PID
123+
124+
# React 19 — same pattern, start its Vite server independently
113125
PORT=$((10000 + RANDOM % 50000))
114-
TEST_PORT=$PORT yarn start-server-and-test "yarn dev-server" http://localhost:$PORT \
115-
"cd packages/framer-motion && cypress run --config-file=cypress.react-19.json --config baseUrl=http://localhost:$PORT --headed --spec cypress/integration/<test-name>.ts"
126+
cd dev/react-19 && TEST_PORT=$PORT yarn vite --port $PORT &
127+
DEV_PID=$!
128+
npx wait-on http://localhost:$PORT
129+
cd packages/framer-motion && cypress run --config-file=cypress.react-19.json --config baseUrl=http://localhost:$PORT --headed --spec cypress/integration/<test-name>.ts
130+
kill $DEV_PID
116131
```
117132

133+
**Do NOT set `TEST_PORT` globally with turbo** — it affects both React 18 and 19 dev servers, causing port conflicts. Start each server independently on its own port as shown above.
134+
118135
Both must pass. If a test fails on one React version but not the other, investigate — do not skip it.
119136

120137
### Async test helpers
@@ -143,9 +160,12 @@ async function nextFrame() {
143160

144161
When working on a bug fix from a GitHub issue:
145162

146-
1. **The reporter's reproduction code is the basis for your test.** If the issue links to a CodeSandbox/StackBlitz, fetch it. Try multiple URL patterns if the first fails. If the issue has inline code, use that directly.
147-
2. **If you cannot get the reproduction code, STOP and ask for help.** Do not guess at what the reporter meant — that leads to tests that prove nothing. Message the team lead with the URL and ask them to provide the code.
148-
3. **Do not proceed to a fix without a test that fails for the right reason.** See the "Writing Tests" section above.
163+
1. **Read the issue first.** Run `gh issue view <number>` before doing anything else. Do not infer the ask from code context or agent exploration — read the actual issue to understand what's being requested.
164+
2. **Check git history early.** Before tracing code, run `git log --grep="<keyword>" -- <relevant-file>` to see if the bug was already fixed or if prior commits reveal the root cause. This can save an entire session of manual code tracing.
165+
3. **The reporter's reproduction code is the basis for your test.** If the issue links to a CodeSandbox/StackBlitz, fetch it. Try multiple URL patterns if the first fails. If the issue has inline code, use that directly.
166+
4. **If you cannot get the reproduction code, STOP and ask for help.** Do not guess at what the reporter meant — that leads to tests that prove nothing. Message the team lead with the URL and ask them to provide the code.
167+
5. **Do not proceed to a fix without a test that fails for the right reason.** See the "Writing Tests" section above.
168+
6. **Run one clean install, then wait for it to finish.** Do not run `make bootstrap`, `yarn install`, or `corepack enable && yarn install` as overlapping background tasks — they interfere with each other. One install command, foreground, wait for completion.
149169

150170
## Known GitHub CLI Issues
151171

0 commit comments

Comments
 (0)