Skip to content

Commit

Permalink
Make sure old segment fetch request doesn't get used
Browse files Browse the repository at this point in the history
  • Loading branch information
ajayyy committed Sep 23, 2024
1 parent 36549e7 commit 4c417b1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1133,14 +1133,17 @@ function setupCategoryPill() {
}

async function sponsorsLookup(keepOldSubmissions = true, ignoreCache = false) {
const videoID = getVideoID()
const videoID = getVideoID();
if (!videoID) {
console.error("[SponsorBlock] Attempted to fetch segments with a null/undefined videoID.");
return;
}

const segmentData = await getSegmentsForVideo(videoID, ignoreCache);

// Make sure an old pending request doesn't get used.
if (videoID !== getVideoID()) return;

// store last response status
lastResponseStatus = segmentData.status;
if (segmentData.status === 200) {
Expand Down

0 comments on commit 4c417b1

Please sign in to comment.