-
Notifications
You must be signed in to change notification settings - Fork 419
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
Conversation
Do you have a branch with an integration test for bpmn-js? Let's verify that this PR fixes the issue when linked with bpmn-js. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add tests (in diagram-js too) which reproduce the issue and allow us to verify the fix.
I extended the integration tests in bpmn-js with one that covers this bug. Failing with current version, passes with the change: bpmn-io/bpmn-js@5d8240d |
@@ -192,6 +192,11 @@ GraphicsFactory.prototype.updateContainments = function(elements) { | |||
forEach(children.slice().reverse(), function(child) { | |||
var childGfx = elementRegistry.getGraphics(child); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jarekdanielak Let's figure out if we fixed the root cause of the issue here, happy to help with a debug session / code review.
I spent some time debugging:
At this point I need some help. I don't know why we call @nikku could you step in? |
@jarekdanielak I'm happy to support you with this. We can have a debugging session together to root cause the problem. |
Thanks @barmac, will remove this from my TODO list. If you folks cannot figure it out, please ping me again. |
Debugging session conclusions so far:
After the shape was removed, it cannot be moved back to the previous parent which is not present on the canvas as well. Therefore, we established that the root cause of the problem is in the implementation of the collapsed subprocess. We still need to find a way to fix it. |
The SubProcessPlaneBehavior is triggered on each |
There's more in this issue than we expected. @jarekdanielak will push our solution sketch with the still not working text annotation part. The diagram-js PR can be closed as we established that the root cause is in bpmn-js. |
Closing this one. More discussion and debugging will happen in bpmn-js: bpmn-io/bpmn-js#2275 |
Proposed Changes
Related to bpmn-io/bpmn-js#2269
Add some null checks to prevent crashes when undo/redo adds or removes a collapsed subprocess.
Checklist
To ensure you provided everything we need to look at your PR:
@bpmn-io/sr
toolCloses {LINK_TO_ISSUE}
orRelated to {LINK_TO_ISSUE}