OpenFn / OpenFn/lightning

Layout fails to finish (never reaches final position) before animation duration ends

Open
#3,333 1 comment 0 reactions 1 assignee View on GitHub

@doc-han is already working on this.

Since Jul 4, 2025.

Dominant language
Elixir
Stars
296
Forks
86
Avg merge
1d 13h
Merged PRs (30d)
50

Description

This second call to forceLayout was introduced (and later removed because it made for a very jumpy experience) to deal with an issue where the nodes would not reach their final positions before the animation duration ended.

A video of the bug: https://www.loom.com/share/08d7c20a76ec4d36b932f8b57bc0cf9f?sid=c6d28c14-03a3-4894-ae06-d97a022b3539

See @doc-han 's notes here:

"""
The issue is due to a timing problem during animation.
The last animation frame is sometimes computed out of the total animation time.
Hence if total animation duration is 300ms.
So animation ends at now + 300ms but then our last frames call back gets called at now + (X > 300)ms.
We then do not render this last animation frame.
Due to this the nodes don't end up at their final desired positions.
They get stuck at a position in-between their initial and final(desired) position.
Hence removing the forceLayout animation would solve this but then there's a possibility that on a stressed machine nodes don't end up at their final destinations after animation
"""

Farhan has confirmed that the gap between desired position and actual position will never be more than 1-2px, so we'd decided to remove this second call. (In other words, the gap—not the big bounce that occurs when calling forceLayout again—is the lesser of two evils.)

This issue is to fix the gap.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.