-
Notifications
You must be signed in to change notification settings - Fork 14
fix: manage state outside of preact to avoid updates with stale element #122
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
Conversation
|
Note:
|
| useEffect(() => { | ||
| const onRootAdded = (e) => { | ||
| const element = e.element; | ||
|
|
||
| if (isImplicitRoot(element)) { | ||
| return; | ||
| } | ||
|
|
||
| _update(element); | ||
| }; | ||
|
|
||
| eventBus.on('root.added', onRootAdded); | ||
|
|
||
| return () => { | ||
| eventBus.off('root.added', onRootAdded); | ||
| }; | ||
| }, [ selectedElement ]); |
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.
This logic can be safely removed as we refuse to render implicit root in _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.
Yes, it was also removed in bpmn-js-properties-panel.
| eventBus.on('propertiesPanel.providersChanged', () => this._update()); | ||
|
|
||
| // Handle root changes more carefully | ||
| eventBus.on('root.added', (event) => { |
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.
What the hell was the agent doing? 😆
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.
We had this logic in the component.
philippfromme
left a comment
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.
🚀
Related to bpmn-io/bpmn-js-properties-panel#1159
Proposed Changes