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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

jarekdanielak
Copy link
Contributor

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:

  • Brief textual description of the changes present
  • Visual demo attached
  • Steps to try out present, i.e. using the @bpmn-io/sr tool
  • Related issue linked via Closes {LINK_TO_ISSUE} or Related to {LINK_TO_ISSUE}

@jarekdanielak jarekdanielak requested review from nikku and barmac January 9, 2025 13:16
@jarekdanielak jarekdanielak self-assigned this Jan 9, 2025
@bpmn-io-tasks bpmn-io-tasks bot added the needs review Review pending label Jan 9, 2025
@barmac
Copy link
Member

barmac commented Jan 9, 2025

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.

Copy link
Member

@barmac barmac left a 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.

@bpmn-io-tasks bpmn-io-tasks bot added in progress Currently worked on and removed needs review Review pending labels Jan 9, 2025
@jarekdanielak
Copy link
Contributor Author

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

@jarekdanielak jarekdanielak requested a review from barmac January 9, 2025 14:51
@bpmn-io-tasks bpmn-io-tasks bot added needs review Review pending and removed in progress Currently worked on labels Jan 9, 2025
@@ -192,6 +192,11 @@ GraphicsFactory.prototype.updateContainments = function(elements) {
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.

Copy link
Member

@nikku nikku left a 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.

@bpmn-io-tasks bpmn-io-tasks bot added in progress Currently worked on and removed needs review Review pending labels Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in progress Currently worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants