File tree Expand file tree Collapse file tree 6 files changed +23
-13
lines changed Expand file tree Collapse file tree 6 files changed +23
-13
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,12 @@ Motion adheres to [Semantic Versioning](http://semver.org/).
4
4
5
5
Undocumented APIs should be considered internal and may change without warning.
6
6
7
+ ## [ 12.23.6] 2025-07-11
8
+
9
+ ### Changed
10
+
11
+ - Added explainer for reduced motion warning.
12
+
7
13
## [ 12.23.5] 2025-07-11
8
14
9
15
### Fixed
Original file line number Diff line number Diff line change @@ -416,7 +416,8 @@ export abstract class VisualElement<
416
416
if ( process . env . NODE_ENV !== "production" ) {
417
417
warnOnce (
418
418
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"
420
421
)
421
422
}
422
423
Original file line number Diff line number Diff line change @@ -40,7 +40,8 @@ export function useReducedMotion() {
40
40
if ( process . env . NODE_ENV !== "production" ) {
41
41
warnOnce (
42
42
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"
44
45
)
45
46
}
46
47
Original file line number Diff line number Diff line change
1
+ import { formatErrorMessage } from "./format-error-message"
2
+
1
3
export type DevMessage = (
2
4
check : boolean ,
3
5
message : string ,
@@ -8,21 +10,15 @@ let warning: DevMessage = () => {}
8
10
let invariant : DevMessage = ( ) => { }
9
11
10
12
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
-
17
13
warning = ( check , message , errorCode ) => {
18
14
if ( ! check && typeof console !== "undefined" ) {
19
- console . warn ( formatMessage ( message , errorCode ) )
15
+ console . warn ( formatErrorMessage ( message , errorCode ) )
20
16
}
21
17
}
22
18
23
19
invariant = ( check , message , errorCode ) => {
24
20
if ( ! check ) {
25
- throw new Error ( formatMessage ( message , errorCode ) )
21
+ throw new Error ( formatErrorMessage ( message , errorCode ) )
26
22
}
27
23
}
28
24
}
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
1
+ import { formatErrorMessage } from "./format-error-message"
2
+
1
3
const warned = new Set < string > ( )
2
4
3
5
export function hasWarned ( message : string ) {
@@ -7,11 +9,10 @@ export function hasWarned(message: string) {
7
9
export function warnOnce (
8
10
condition : boolean ,
9
11
message : string ,
10
- element ?: Element
12
+ errorCode ?: string
11
13
) {
12
14
if ( condition || warned . has ( message ) ) return
13
15
14
- console . warn ( message )
15
- if ( element ) console . warn ( element )
16
+ console . warn ( formatErrorMessage ( message , errorCode ) )
16
17
warned . add ( message )
17
18
}
You can’t perform that action at this time.
0 commit comments