-
Notifications
You must be signed in to change notification settings - Fork 14k
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: color collision in dashboard with tabs #24670
Conversation
Codecov Report
@@ Coverage Diff @@
## master #24670 +/- ##
=======================================
Coverage 68.97% 68.97%
=======================================
Files 1901 1901
Lines 74006 74008 +2
Branches 8182 8183 +1
=======================================
+ Hits 51045 51047 +2
Misses 20840 20840
Partials 2121 2121
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Object.entries(this.parentForcedColors).forEach(([key, value]) => { | ||
if (key !== cleanedValue) { | ||
const index = updatedRange.indexOf(value); | ||
updatedRange.splice(index, 1); |
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.
could you use a filter method on updatedRange here instead? That may be a little more succinct.
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.
Yeah, this looks great!
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.
Additional suggestion: #24670 (comment)
339b33a
to
e62cee9
Compare
let updatedRange = [...this.originColors]; | ||
// remove the color option from shared color | ||
sharedColorMap.forEach((value: string, key: string) => { | ||
if (key !== cleanedValue) { | ||
const index = updatedRange.indexOf(value); | ||
updatedRange.splice(index, 1); | ||
updatedRange = updatedRange.filter(color => color !== value); | ||
} | ||
}); | ||
Object.entries(this.parentForcedColors).forEach(([key, value]) => { | ||
if (key !== cleanedValue) { | ||
updatedRange = updatedRange.filter(color => color !== value); | ||
} | ||
}); // remove the color option from forced colors |
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.
The combination of forEach
and .filter
operation can be heavy. It should be better using a hashset to filter out the values.
let updatedRange = [...this.originColors]; | |
// remove the color option from shared color | |
sharedColorMap.forEach((value: string, key: string) => { | |
if (key !== cleanedValue) { | |
const index = updatedRange.indexOf(value); | |
updatedRange.splice(index, 1); | |
updatedRange = updatedRange.filter(color => color !== value); | |
} | |
}); | |
Object.entries(this.parentForcedColors).forEach(([key, value]) => { | |
if (key !== cleanedValue) { | |
updatedRange = updatedRange.filter(color => color !== value); | |
} | |
}); // remove the color option from forced colors | |
const updatedRange = new Set(this.originColors); | |
// remove the color option from shared color | |
sharedColorMap.forEach((value: string, key: string) => { | |
if (key !== cleanedValue) { | |
updatedRange.delete(value); | |
} | |
} | |
Object.entries(this.parentForcedColors).forEach(([key, value]) => { | |
if (key !== cleanedValue) { | |
updatedRange.delete(value); | |
} | |
} | |
this.range(updatedRange.size > 0 ? [...updatedRange] : this.originColors); |
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.
oh nice. i will use that
6d42537
to
5df4705
Compare
c7a50b4
to
622ae33
Compare
(cherry picked from commit 0328dd2)
SUMMARY
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:
After:
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION