test(core): cover declarative useSpring auto-start under StrictMode (#2361)#2531
Merged
Conversation
…2361) Every existing StrictMode test attaches an external ref and starts it imperatively. The pure declarative, no-ref path from the issue's codesandbox was uncovered. These guard both the basic from->to case and the looped variant, which regressed pre-v10 when StrictMode's double mount left the controller stopped with an empty updates array.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Lock down the declarative, no-ref
useSpringauto-start path under React StrictMode — the exact scenario from the codesandbox in #2361 (and the earlier #2146).The bug those issues describe was fixed across the v10 line (#2372, #2410, #2430):
useSpringsnow keepsupdatesin a ref plus a StrictMode restart snapshot, so the double-mount (mount → simulated unmount → mount) re-applies updates instead of leaving the controller stopped with an emptyupdatesarray.But every existing StrictMode test attaches an external
refand calls.start()imperatively. The pure declarative path that real users hit — no ref, animation expected to fire on its own — had no coverage. These two tests close that gap: one for the basicfrom→tocase, one for the looped variant flagged in the issue thread. Both fail against the pre-v10 code and pass onnext.