diff options
author | Ajay <[email protected]> | 2024-09-23 04:05:20 -0400 |
---|---|---|
committer | Ajay <[email protected]> | 2024-09-23 04:05:20 -0400 |
commit | 4c417b10fed560c39c925dffb217b91f898a2f0f (patch) | |
tree | 2110d745748e9f683b2f792bc8e28e7535e3657c | |
parent | 36549e7898fcf32dba90c5225d3c0dfa736134e9 (diff) | |
download | SponsorBlock-4c417b10fed560c39c925dffb217b91f898a2f0f.tar.gz SponsorBlock-4c417b10fed560c39c925dffb217b91f898a2f0f.zip |
Make sure old segment fetch request doesn't get used
May fix #2101
See https://github.com/ajayyy/SponsorBlock/commit/dbf80b492902ecc55fc5b207ae5aa600be4a3bd0#r147058589
-rw-r--r-- | src/content.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/content.ts b/src/content.ts index a30bf3a5..c02db6c6 100644 --- a/src/content.ts +++ b/src/content.ts @@ -1133,7 +1133,7 @@ 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; @@ -1141,6 +1141,9 @@ async function sponsorsLookup(keepOldSubmissions = true, ignoreCache = false) { 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) { |