Skip to content

Commit 82396e9

Browse files
committed
Updating changelog
1 parent db66bee commit 82396e9

File tree

6 files changed

+23
-13
lines changed

6 files changed

+23
-13
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.23.6] 2025-07-11
8+
9+
### Changed
10+
11+
- Added explainer for reduced motion warning.
12+
713
## [12.23.5] 2025-07-11
814

915
### Fixed

packages/framer-motion/src/render/VisualElement.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,8 @@ export abstract class VisualElement<
416416
if (process.env.NODE_ENV !== "production") {
417417
warnOnce(
418418
this.shouldReduceMotion !== true,
419-
"You have Reduced Motion enabled on your device. Animations may not appear as expected."
419+
"You have Reduced Motion enabled on your device. Animations may not appear as expected.",
420+
"reduced-motion-disabled"
420421
)
421422
}
422423

packages/framer-motion/src/utils/reduced-motion/use-reduced-motion.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ export function useReducedMotion() {
4040
if (process.env.NODE_ENV !== "production") {
4141
warnOnce(
4242
shouldReduceMotion !== true,
43-
"You have Reduced Motion enabled on your device. Animations may not appear as expected."
43+
"You have Reduced Motion enabled on your device. Animations may not appear as expected.",
44+
"reduced-motion-disabled"
4445
)
4546
}
4647

packages/motion-utils/src/errors.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { formatErrorMessage } from "./format-error-message"
2+
13
export type DevMessage = (
24
check: boolean,
35
message: string,
@@ -8,21 +10,15 @@ let warning: DevMessage = () => {}
810
let invariant: DevMessage = () => {}
911

1012
if (process.env.NODE_ENV !== "production") {
11-
const formatMessage = (message: string, errorCode?: string) => {
12-
return errorCode
13-
? `${message}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${errorCode}`
14-
: message
15-
}
16-
1713
warning = (check, message, errorCode) => {
1814
if (!check && typeof console !== "undefined") {
19-
console.warn(formatMessage(message, errorCode))
15+
console.warn(formatErrorMessage(message, errorCode))
2016
}
2117
}
2218

2319
invariant = (check, message, errorCode) => {
2420
if (!check) {
25-
throw new Error(formatMessage(message, errorCode))
21+
throw new Error(formatErrorMessage(message, errorCode))
2622
}
2723
}
2824
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export function formatErrorMessage(message: string, errorCode?: string) {
2+
return errorCode
3+
? `${message}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${errorCode}`
4+
: message
5+
}
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { formatErrorMessage } from "./format-error-message"
2+
13
const warned = new Set<string>()
24

35
export function hasWarned(message: string) {
@@ -7,11 +9,10 @@ export function hasWarned(message: string) {
79
export function warnOnce(
810
condition: boolean,
911
message: string,
10-
element?: Element
12+
errorCode?: string
1113
) {
1214
if (condition || warned.has(message)) return
1315

14-
console.warn(message)
15-
if (element) console.warn(element)
16+
console.warn(formatErrorMessage(message, errorCode))
1617
warned.add(message)
1718
}

0 commit comments

Comments
 (0)