Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
169c294e62 | ||
|
|
e2df60d112 |
@@ -17,6 +17,7 @@ const {
|
||||
disconnectObserver,
|
||||
setInitialLoad,
|
||||
showMessageForXSeconds,
|
||||
markCurrentArticleRead,
|
||||
} = useFeeds()
|
||||
|
||||
const unreadCount = computed(() => feeds.value.filter(f => !f.read).length)
|
||||
@@ -122,6 +123,11 @@ onBeforeUnmount(() => {
|
||||
onMounted(async () => {
|
||||
setInitialLoad(false)
|
||||
await fetchData()
|
||||
// viewMode persists across reloads (see useFeeds.js) — if we're booting
|
||||
// straight into article view, the article now on screen needs the same
|
||||
// immediate mark-read that toggleViewMode()/nextArticle()/prevArticle()
|
||||
// give it when reached by in-session navigation.
|
||||
if (viewMode.value === 'article') markCurrentArticleRead()
|
||||
sync(true)
|
||||
setTimeout(function () {
|
||||
setInitialLoad(true)
|
||||
|
||||
@@ -57,6 +57,10 @@ describe('viewMode boot persistence', () => {
|
||||
expect(wrapper.find('.article-single').exists()).toBe(true)
|
||||
expect(wrapper.find('#article').exists()).toBe(false)
|
||||
|
||||
// The article shown right after reload must be marked read immediately —
|
||||
// not only once the user pages forward/back at least once.
|
||||
expect(axios.put).toHaveBeenCalledWith('/api/v1/article/read/1', null, expect.anything())
|
||||
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
|
||||
@@ -593,6 +593,7 @@ export function useFeeds() {
|
||||
currentIndex,
|
||||
toggleViewMode,
|
||||
leaveArticleView,
|
||||
markCurrentArticleRead,
|
||||
layout,
|
||||
toggleLayout,
|
||||
nextArticle,
|
||||
|
||||
Reference in New Issue
Block a user