-
Notifications
You must be signed in to change notification settings - Fork 33
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(API): prevent a reset/remove when passing an empty string #2900
Conversation
This applies to the "remove all CSS classes" and "reset style" APIs. These two methods are intended to apply to all elements when a nullish parameter is passed. However, they previously applied to the empty string because the condition was checking the "falsy" state instead. New tests have been added to reproduce the problem and validate the fix.
♻️ PR Preview ad2dfb5 has been successfully destroyed since this PR has been closed. 🤖 By surge-preview |
♻️ PR Preview ad2dfb5 has been successfully destroyed since this PR has been closed. 🤖 By surge-preview |
@@ -84,7 +84,7 @@ export class StyleUpdater { | |||
|
|||
resetStyle(bpmnElementIds: string | string[]): void { | |||
this.graph.batchUpdate(() => { | |||
if (bpmnElementIds) { | |||
if (bpmnElementIds || bpmnElementIds == '') { |
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.
thought: we may introduce a function to manage this check
It could improve readability while eliminating duplication (which is not really mandatory here).
Kudos, SonarCloud Quality Gate passed! |
This fix applies to the "remove all CSS classes" and "reset style" APIs.
These two methods are intended to apply to all elements when a "nullish" parameter is passed. However, they previously applied to the empty string because the condition was checking the "falsy" state instead.
New tests have been added to reproduce the problem and validate the fix.