fix: Fix for cells not removed (#115)

There was a logical error in processing `ChildChange` in `Graph`. When cell was removed, `ChildChange` created to change parent of removed cell to `null`. But in code, if parent is null, code to destroy child cell state was not called, so cell stayed rendered on canvas.

The fix add a check for "falsy" parent, so correct branch of code is executed and cells are destroyed.
development
Анатолий Майоров 2022-12-08 10:27:11 +03:00 committed by GitHub
parent 7e9bc662be
commit a3b5a60c60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -591,8 +591,7 @@ class Graph extends EventSource {
this.view.invalidate(change.child, true, true);
if (
newParent &&
(!this.getDataModel().contains(newParent) || newParent.isCollapsed())
!newParent || !this.getDataModel().contains(newParent) || newParent.isCollapsed()
) {
this.view.invalidate(change.child, true, true);
this.removeStateForCell(change.child);