@@ -288,19 +288,24 @@ export class Controller<State extends Indexable = UnknownProps>
288
288
const props : PendingProps < State > = inferTo ( propsArg ) as any
289
289
let { from, to, reverse, delay } = props as any
290
290
291
- // Avoid sending async "to" prop to springs.
292
- if ( is . arr ( to ) || is . fun ( to ) ) {
293
- to = undefined
294
- }
295
-
296
291
// Each update only affects the springs whose keys have defined values.
297
292
const keys = ( props . keys = new Set < string > ( ) )
298
- const findDefined = ( values : any ) =>
299
- values &&
300
- each ( values , ( value , key ) => value != null && keys . add ( key as any ) )
301
293
302
- findDefined ( from )
303
- findDefined ( to )
294
+ if ( from ) {
295
+ findDefined ( from , keys )
296
+ } else {
297
+ // Falsy values are ignored.
298
+ props . from = from = undefined
299
+ }
300
+
301
+ if ( is . obj ( to ) ) {
302
+ findDefined ( to , keys )
303
+ } else {
304
+ // Falsy values are ignored.
305
+ if ( ! to ) props . to = undefined
306
+ // Avoid passing functions/arrays to SpringValue objects.
307
+ to = undefined
308
+ }
304
309
305
310
// Create our springs and give them values.
306
311
const springs = this . springs as Indexable < SpringValue >
@@ -352,6 +357,11 @@ export class Controller<State extends Indexable = UnknownProps>
352
357
}
353
358
}
354
359
360
+ /** Find keys with defined values */
361
+ function findDefined ( values : any , keys : Set < string > ) {
362
+ each ( values , ( value , key ) => value != null && keys . add ( key as any ) )
363
+ }
364
+
355
365
/** Basic helper for clearing a queue after processing it */
356
366
function flush < P , T > (
357
367
queue : Map < P , T > ,
0 commit comments