mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-12 22:47:18 +03:00
Reset fvlabel color definitions when segment == null
Without this, we would try to use the color for an 'undefined' category on the first render pass of the element. It was then immediately re-rendered with a segment set, but DR missed the update, which caused it to stick to that 'undefined' category and the label became transparent.
This commit is contained in:
@@ -117,13 +117,13 @@ class CategoryPillComponent extends React.Component<CategoryPillProps, CategoryP
|
|||||||
private getColor(): string {
|
private getColor(): string {
|
||||||
// Handled by setCategoryColorCSSVariables() of content.ts
|
// Handled by setCategoryColorCSSVariables() of content.ts
|
||||||
const category = this.state.segment?.category;
|
const category = this.state.segment?.category;
|
||||||
return `var(--sb-category-preview-${category}, var(--sb-category-${category}))`;
|
return category == null ? null : `var(--sb-category-preview-${category}, var(--sb-category-${category}))`;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getTextColor(): string {
|
private getTextColor(): string {
|
||||||
// Handled by setCategoryColorCSSVariables() of content.ts
|
// Handled by setCategoryColorCSSVariables() of content.ts
|
||||||
const category = this.state.segment?.category;
|
const category = this.state.segment?.category;
|
||||||
return `var(--sb-category-text-preview-${category}, var(--sb-category-text-${category}))`;
|
return category == null ? null : `var(--sb-category-text-preview-${category}, var(--sb-category-text-${category}))`;
|
||||||
}
|
}
|
||||||
|
|
||||||
private openTooltip(): void {
|
private openTooltip(): void {
|
||||||
|
|||||||
Reference in New Issue
Block a user