Skip to content
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 undo/redo for collapsed subprocesses #957

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/core/GraphicsFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@
forEach(children.slice().reverse(), function(child) {
var childGfx = elementRegistry.getGraphics(child);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I struggle to understand in which situation this can become an issue, could you elaborate? And would you be able to model this as a test case in diagram-js?

From what I understand:

  • GraphicsFactory#updateContainment is being called after any change operation happened (ref)
  • At this stage, looking at the model, parents for updated children are collected
  • Then the children inside these parents are re-ordered
  • BUT some of the children are actually NOT part of the render tree anymore?

The BUT is the big issue for me. How can children exist, but not actually be rendered? Where don't we properly update the model before we render?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may also be that we messed up the bpmn-js implementation.


// shape was removed
if (!childGfx) {
return;

Check warning on line 197 in lib/core/GraphicsFactory.js

View check run for this annotation

Codecov / codecov/patch

lib/core/GraphicsFactory.js#L197

Added line #L197 was not covered by tests
}

prependTo(childGfx.parentNode, childrenGfx);
});
});
Expand Down
2 changes: 1 addition & 1 deletion lib/features/modeling/cmd/MoveConnectionHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ MoveConnectionHandler.prototype.revert = function(context) {
delta = context.delta;

// remove from newParent
collectionRemove(newParent.children, connection);
newParent && collectionRemove(newParent.children, connection);

// restore previous location in old parent
collectionAdd(oldParent.children, connection, oldParentIndex);
Expand Down
Loading