Skip to content

Commit 5043a5f

Browse files
committed
Sync internal hidden status with segment's value on change
1 parent 808c371 commit 5043a5f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/popup/SegmentListComponent.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ function SegmentListItem({ segment, videoID, currentTime, isVip, loopedChapter,
149149
const [hidden, setHidden] = React.useState(segment.hidden ?? SponsorHideType.Visible); // undefined ?? undefined lol
150150
const [isLooped, setIsLooped] = React.useState(loopedChapter === segment.UUID);
151151

152+
// Update internal state if the hidden property of the segment changes
153+
React.useEffect(() => {
154+
setHidden(segment.hidden ?? SponsorHideType.Visible);
155+
}, [segment.hidden])
156+
152157
let extraInfo: string;
153158
switch (hidden) {
154159
case SponsorHideType.Visible:

0 commit comments

Comments
 (0)