-
-
Notifications
You must be signed in to change notification settings - Fork 35
fix(force-simulation): Fix a bug that would sometimes keep a simulation running indefinitely #546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(force-simulation): Fix a bug that would sometimes keep a simulation running indefinitely #546
Conversation
🦋 Changeset detectedLatest commit: 950214d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
commit: |
techniq
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! I noticed this the other day while I was experimenting with something. Thanks for the fix!
|
@regexident care to run |
…on running, when its inputs change, even if `alpha < alphaMin`
950214d to
cd6f755
Compare
cd6f755 to
950214d
Compare
I discovered the bug while experimenting with an approach of adjusting the
alphaTarget/alphaDecaydynamically, based on the simulation's total kinetic energy (i.e. sum of node velocities): the simulation just kept running, despitealphahaving dropped far, far below0.001already.Any change to
alphaTarget/alphaDecaycaused the simulation to get restarted, even ifalphahad already fallen belowalphaMin.There are a couple of places where
runOrResumeSimulation();gets called, but currently only one of them is guarded by aalpha >= alphaMincheck, so I move the check intorunOrResumeSimulation()itself.The bug is trivially reproducible by doing something like this: