mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-14 15:37:12 +03:00
Sync internal hidden status with segment's value on change
This commit is contained in:
@@ -149,6 +149,11 @@ function SegmentListItem({ segment, videoID, currentTime, isVip, loopedChapter,
|
|||||||
const [hidden, setHidden] = React.useState(segment.hidden ?? SponsorHideType.Visible); // undefined ?? undefined lol
|
const [hidden, setHidden] = React.useState(segment.hidden ?? SponsorHideType.Visible); // undefined ?? undefined lol
|
||||||
const [isLooped, setIsLooped] = React.useState(loopedChapter === segment.UUID);
|
const [isLooped, setIsLooped] = React.useState(loopedChapter === segment.UUID);
|
||||||
|
|
||||||
|
// Update internal state if the hidden property of the segment changes
|
||||||
|
React.useEffect(() => {
|
||||||
|
setHidden(segment.hidden ?? SponsorHideType.Visible);
|
||||||
|
}, [segment.hidden])
|
||||||
|
|
||||||
let extraInfo: string;
|
let extraInfo: string;
|
||||||
switch (hidden) {
|
switch (hidden) {
|
||||||
case SponsorHideType.Visible:
|
case SponsorHideType.Visible:
|
||||||
|
|||||||
Reference in New Issue
Block a user