This commit is contained in:
2026-09-26 15:23:36 +02:00
parent 990f463534
commit 27f5e3563f
18 changed files with 1226 additions and 559 deletions
+24
View File
@@ -1594,6 +1594,7 @@
};
let isReCenteringFeed = false;
let lastAttemptedTagCenterKey = null;
const highlightActiveTagCard = (scrollIntoView = false) => {
const identifiers = getCurrentItemIdentifiers();
@@ -1619,6 +1620,10 @@
}
});
if (matchedCard) {
lastAttemptedTagCenterKey = null;
}
if (matchedCard && scrollIntoView) {
const isTagTabActive = document.querySelector('.sidebar-tab.active')?.dataset.tab === 'tag' &&
container.style.display !== 'none';
@@ -1639,6 +1644,11 @@
window._isPoolRandomNav = false;
return;
}
const centerKey = `${currentTag}:${identifiers[0]}`;
if (lastAttemptedTagCenterKey === centerKey) {
return;
}
lastAttemptedTagCenterKey = centerKey;
// Non-pool navigation (next/prev): center feed around the active item
isReCenteringFeed = true;
loadTagFeed(true, identifiers[0]).finally(() => {
@@ -1664,6 +1674,7 @@
if (currentTag !== tag) {
currentTag = tag;
lastAttemptedTagCenterKey = null;
tagOffset = 0;
tagFeedLoaded = false;
tagFeedNeedsReload = true;
@@ -1681,6 +1692,7 @@
} else {
tagBtn.style.display = 'none';
currentTag = null;
lastAttemptedTagCenterKey = null;
tagFeedLoaded = false;
userManuallySelectedNonTagTab = false;
@@ -1886,6 +1898,7 @@
};
let isReCenteringFavsFeed = false;
let lastAttemptedFavsCenterKey = null;
const highlightActiveFavsCard = (scrollIntoView = false) => {
const identifiers = getCurrentItemIdentifiers();
@@ -1908,6 +1921,10 @@
}
});
if (matchedCard) {
lastAttemptedFavsCenterKey = null;
}
if (matchedCard && scrollIntoView) {
const isFavsTabActive = document.querySelector('.sidebar-tab.active')?.dataset.tab === 'favs' &&
container.style.display !== 'none';
@@ -1921,6 +1938,11 @@
}
}
} else if (scrollIntoView && !matchedCard && identifiers.length > 0 && currentFavsUser && !isReCenteringFavsFeed && !favsFeedLoading) {
const centerKey = `${currentFavsUser}:${identifiers[0]}`;
if (lastAttemptedFavsCenterKey === centerKey) {
return;
}
lastAttemptedFavsCenterKey = centerKey;
isReCenteringFavsFeed = true;
loadFavsFeed(true, identifiers[0]).finally(() => {
isReCenteringFavsFeed = false;
@@ -2043,6 +2065,7 @@
if (currentFavsUser !== user) {
currentFavsUser = user;
lastAttemptedFavsCenterKey = null;
favsOffset = 0;
favsFeedLoaded = false;
favsFeedNeedsReload = true;
@@ -2057,6 +2080,7 @@
} else {
favsBtn.style.display = 'none';
currentFavsUser = null;
lastAttemptedFavsCenterKey = null;
favsFeedLoaded = false;
const activeTab = document.querySelector('.sidebar-tab.active')?.dataset.tab;