You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
spring returns NaN and breaks physics simulation when config has undefined properties #7607
When calling spring() with a config object containing undefined properties (common when passing optional React props: { damping: props.damping, stiffness: props.stiffness }), springCalculation merges the configuration with object spread:
If stiffness or mass is undefined, it overrides defaultSpringConfig's value with undefined. In advance(), Math.sqrt(k / m) calculates Math.sqrt(undefined / 1) = NaN, causing spring() to return NaN for every frame.
If damping is undefined, zeta evaluates to NaN. Because NaN < 1 is false, it bypasses underDampedPosition and silently forces the spring into criticallyDampedPosition, breaking underdamped spring physics without error.
Steps To Reproduce
Steps To Reproduce
Call spring with an optional property explicitly set to undefined:
Hi! @codeCraft-Ritik I’d like to work on this issue. I’ll reproduce the undefined configuration behavior, implement the resolved spring config fallback, and add regression tests to cover optional/undefined configuration values.
Activity
harshvardhankhare commentedon Sep 17, 2026
Hi! @codeCraft-Ritik I’d like to work on this issue. I’ll reproduce the
undefinedconfiguration behavior, implement the resolved spring config fallback, and add regression tests to cover optional/undefined configuration values.fulluhere commentedon Sep 23, 2026
#7607