ls1intum / Apollon

UML Modeling Editor written in React
https://apollon-library.readthedocs.io
MIT License
61 stars 21 forks source link

fix layouting issues with collab #347

Closed loreanvictor closed 3 months ago

loreanvictor commented 3 months ago

Checklist

Motivation and Context

Importing patches can sometimes lead to broken layouts: for example when a relationship is updated, its path might have been set due to a different context (state) than what is present on local machine (perhaps due to concurrent changes), resulting in broken relationships.

Description

This PR fixes the aforementioned issues by running layouter after importing patches. This used to be the flow, but due to layouter instability and locking certain actions (e.g. resizing), was disabled for a while. The layouter is now executed with a debounce, to mitigate its inherent instability and provide a smoother user experience.

Steps for Testing

  1. Run two Apollon instances using Apollon_standalone.
  2. Try to make changes at the same time and break the layouts.

They layouts should typically fix themselves. Using subscribeToAllModelChangePatches() method helps with finding corner cases more easily.

Test Coverage

File Branch Line
services/patcher/patcher-saga.ts 76.92% 91.48%