roact-spring icon indicating copy to clipboard operation
roact-spring copied to clipboard

Unmounting parent component during loop.delay does not disconnect spring

Open benbrimeyer opened this issue 2 years ago • 1 comments

Steps to reproduce

return function(props)
	local styles = ReactSpring.useSpring({
		from = { transparency = 0 },
		to = { transparency = 1 },
		loop = { reset = true, delay = 2 },
	})

	styles.transparency:map(function(value)
		print("value:", value)
		return value
	end)
end

unmount while the delay of 2 is active.

Expected: The spring will no longer print after 2 seconds

Actual: The spring will continue to live in the background.

This doesnt occur if the component is unmounted while the spring is running.

benbrimeyer avatar Jan 10 '23 23:01 benbrimeyer

This is still happening in 2025 as of version 2.0.0!

NobleDraconian avatar Jan 27 '25 21:01 NobleDraconian