Skip to content

Commit 38a7f2b

Browse files
committed
fix: keep "onChange" and "onAnimate" out of "Controller.defaultProps"
These events aren't batched, so it's pointless to keep them in the defaultProps object.
1 parent b5ccce4 commit 38a7f2b

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

packages/core/src/Controller.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,8 @@ import { interpolateTo } from './helpers'
2525
import { SpringValue } from './SpringValue'
2626
import { FrameValue } from './FrameValue'
2727

28-
const EVENT_NAMES = [
29-
'onFrame',
30-
'onStart',
31-
'onRest',
32-
'onChange',
33-
'onAnimate',
34-
] as const
28+
/** Events batched by the `Controller` class */
29+
const BATCHED_EVENTS = ['onFrame', 'onStart', 'onRest'] as const
3530

3631
/** A callback that receives the changed values for each frame. */
3732
export type OnFrame<State extends Indexable> = (
@@ -199,7 +194,7 @@ export class Controller<State extends Indexable = UnknownProps>
199194
props.onStart = onStart
200195
props.onRest = onRest
201196

202-
each(EVENT_NAMES, key => {
197+
each(BATCHED_EVENTS, key => {
203198
const value: any = props[key] || this.defaultProps[key]
204199
if (value && props.default) {
205200
this.defaultProps[key] = value

0 commit comments

Comments
 (0)