Skip to content

Conversation

@philippfromme
Copy link
Contributor

@philippfromme philippfromme commented Nov 18, 2025

Fixes the stale element issue by updating on import.done. I tried a different approach but failed. This is the only fix I found that doesn't inroduce significant changes like #1159.

The fix can be verified using https://github.com/bpmn-io/bpmn-js-properties-panel/tree/1131-stale-element-tmp:

npx @bpmn-io/sr bpmn-io/bpmn-js-properties-panel#1131-stale-element-tmp

Fixes #1131

Proposed Changes

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}

@bpmn-io-tasks bpmn-io-tasks bot added the in progress Currently worked on label Nov 18, 2025
Copilot finished reviewing on behalf of philippfromme November 18, 2025 10:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a stale element issue by changing the event listener from root.added to import.done in the BpmnPropertiesPanel component. The change ensures the properties panel is properly updated when a BPMN diagram is imported, addressing issue #1131.

Key changes:

  • Event listener changed from root.added to import.done in the main component
  • Test updated to reflect the new event being listened to
  • Canvas mock infrastructure enhanced to support testing

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/render/BpmnPropertiesPanel.js Changed event listener from root.added to import.done, now retrieves root element from canvas service, and removed selectedElement from dependency array
test/spec/BpmnPropertiesPanel.spec.js Updated test name and event firing to match new import.done behavior, added canvas mock setup in test helper
test/spec/mocks/index.js Enhanced Injector mock to accept canvas option for testing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@philippfromme philippfromme marked this pull request as ready for review November 18, 2025 10:01
@bpmn-io-tasks bpmn-io-tasks bot added needs review Review pending and removed in progress Currently worked on labels Nov 18, 2025
@nikku
Copy link
Member

nikku commented Nov 24, 2025

Does it continue to work with drilldown into sub-processes? This is the reason we hooked up to root.added initially. And depending on what we want to accomplish it could be root.set, too.

@nikku
Copy link
Member

nikku commented Nov 24, 2025

Does it continue to work with drilldown into sub-processes? This is the reason we hooked up to root.added initially. And depending on what we want to accomplish it could be root.set, too.

It looks as if it continues to work as expected ✔️

@barmac
Copy link
Member

barmac commented Nov 25, 2025

Does it continue to work with drilldown into sub-processes? This is the reason we hooked up to root.added initially. And depending on what we want to accomplish it could be root.set, too.

I checked the subprocess part in the review, and indeed it works fine.

@philippfromme
Copy link
Contributor Author

I will go ahead and implement the same fix in dmn-js-properties-panel.

@philippfromme philippfromme merged commit 606f535 into main Dec 1, 2025
21 of 27 checks passed
@philippfromme philippfromme deleted the 1131-stale-element-2 branch December 1, 2025 10:17
@bpmn-io-tasks bpmn-io-tasks bot removed the needs review Review pending label Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Properties panel updated with stale element

4 participants