Skip to content

Commit

Permalink
setting segment is before node rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
hanydd committed Feb 4, 2025
1 parent 1c25ccd commit e431d8b
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/render/CategoryPill.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ export class CategoryPill {
// bilibili will set the textContent of the title after loading for some reason.
// If the node is inserted before this reset of title, it will be removed
const mutationCounter = () => (this.mutationCount += 1);
mutationCounter.bind(this);
this.mutationObserver = new MutationObserver(mutationCounter);
this.mutationObserver = new MutationObserver(mutationCounter.bind(this));

addCleanupListener(() => {
if (this.mutationObserver) {
Expand Down Expand Up @@ -117,8 +116,6 @@ export class CategoryPill {
}

async setSegment(segment: SponsorTime): Promise<void> {
await waitFor(() => this.ref.current);

if (this.ref.current?.state?.segment !== segment) {
const newState = {
segment,
Expand Down

0 comments on commit e431d8b

Please sign in to comment.