ls1intum / Apollon

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

Enhancement/discrete changes #159

Closed iozbeyli closed 3 years ago

iozbeyli commented 3 years ago

Motivation

For real time collaboration between users, sending every change to the server is not efficient. Therefore, the update needs to be send only at the end of user actions. For example, when user is moving an element, every bit of movement of the element notifies the subscribers for a model change. Instead we want to notify subscriber only when user lets go the element and is done with updating the model.

Description

Add a new state in to store that is called lastAction which stores the last action that is dispatched. If the lastAction dispatched ends with END or DELETE, Apollon notifies subscribers about a discrete model change. This way we are only getting the end of each action. Every user action typically calls 3 actions sequentially which are action_START, action and action_END. And there are two exceptions which are APPEND and DELETE.

Test Coverage

The tests for the new functions are added. apollon-editor.ts has 88.56% coverage