Make sure old segment fetch request doesn't get used

May fix #2101

See dbf80b4929 (r147058589)
This commit is contained in:
Ajay
2024-09-23 04:05:20 -04:00
parent 36549e7898
commit 4c417b10fe

View File

@@ -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) {