remove slide effect
This commit is contained in:
@@ -43,6 +43,21 @@ const unreadCount = computed(() => {
|
||||
: allItems.value
|
||||
return items.filter(i => !i.read).length
|
||||
})
|
||||
// AppNav renders this snapshot (refreshed via refreshUnreadDisplay, below)
|
||||
// for the filter <select>'s per-feed option counts, instead of binding
|
||||
// feedUnreadCounts directly — by design, this stays frozen while paging
|
||||
// through article view (markCurrentArticleRead marks one article read per
|
||||
// page turn, which would otherwise recompute it live on every single swipe).
|
||||
// The header's own unread badge stays bound to the live unreadCount (it
|
||||
// should update in real time regardless of view). Everywhere else that marks
|
||||
// articles read — list-view scrolling (handleIntersection), opening/changing
|
||||
// the filter, syncing, mark-all-read, leaving article view — refreshes this
|
||||
// snapshot immediately, so it only ever looks stale during article-view
|
||||
// paging itself.
|
||||
const displayedFeedUnreadCounts = ref({})
|
||||
function refreshUnreadDisplay() {
|
||||
displayedFeedUnreadCounts.value = feedUnreadCounts.value
|
||||
}
|
||||
const message = ref('')
|
||||
const showModal = ref(false)
|
||||
const viewMode = ref(localStorage.getItem('viewMode') || 'list') // 'list' | 'article' — toggled from the hamburger menu, persisted per device
|
||||
@@ -242,6 +257,7 @@ async function setFeedFilter(title) {
|
||||
feedFilter.value = title // null for "All feeds"
|
||||
currentIndex.value = 0
|
||||
applyFilter()
|
||||
refreshUnreadDisplay()
|
||||
await nextTick()
|
||||
setupIntersectionObserver()
|
||||
}
|
||||
@@ -259,6 +275,7 @@ const fetchData = async () => {
|
||||
items.sort((a, b) => b.timestamp.localeCompare(a.timestamp));
|
||||
allItems.value = items;
|
||||
applyFilter();
|
||||
refreshUnreadDisplay();
|
||||
await nextTick();
|
||||
setupIntersectionObserver();
|
||||
} catch (error) {
|
||||
@@ -346,6 +363,7 @@ function handleIntersection(entries, topbarHeight = 0) {
|
||||
feeds.value = feeds.value.filter(feed => !readIds.has(feed.id))
|
||||
// Mirror into the master so cleared filters don't resurrect read articles.
|
||||
allItems.value = allItems.value.filter(feed => !readIds.has(feed.id))
|
||||
refreshUnreadDisplay()
|
||||
|
||||
for (const feed of readFeeds) {
|
||||
markRead(feed.id)
|
||||
@@ -392,6 +410,7 @@ async function markAllRead() {
|
||||
// is active) — drop exactly those from the master too.
|
||||
allItems.value = allItems.value.filter(feed => !readIds.has(feed.id))
|
||||
currentIndex.value = 0
|
||||
refreshUnreadDisplay()
|
||||
// markRead swallows its own errors, so Promise.all can't reject here.
|
||||
await Promise.all(ids.map(id => markRead(id)))
|
||||
showMessageForXSeconds('All articles marked as read.', 5)
|
||||
@@ -418,6 +437,7 @@ async function leaveArticleView() {
|
||||
currentIndex.value = 0
|
||||
viewMode.value = 'list'
|
||||
localStorage.setItem('viewMode', viewMode.value)
|
||||
refreshUnreadDisplay()
|
||||
// The v-if on the list container tears down and recreates all .observe DOM
|
||||
// nodes when switching views, so the intersection observer must be
|
||||
// re-pointed at the new elements after Vue has finished rendering.
|
||||
@@ -479,6 +499,8 @@ export function useFeeds() {
|
||||
feedTitles,
|
||||
feedUnreadCounts,
|
||||
unreadCount,
|
||||
displayedFeedUnreadCounts,
|
||||
refreshUnreadDisplay,
|
||||
setFeedFilter,
|
||||
showMessage,
|
||||
message,
|
||||
|
||||
Reference in New Issue
Block a user