mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Clear cache on force, return updated read position values
This commit is contained in:
parent
97efbe4487
commit
bdf01ddaab
1 changed files with 16 additions and 1 deletions
|
|
@ -112,6 +112,7 @@ import {
|
|||
parsePreparedContent,
|
||||
} from '../../utils/parser'
|
||||
import { getStorageFileDetails } from '../../utils/uploads'
|
||||
import { clearCachedReadingPosition } from '../../services/cached_reading_position'
|
||||
|
||||
export enum ArticleFormat {
|
||||
Markdown = 'markdown',
|
||||
|
|
@ -621,7 +622,10 @@ export const saveArticleReadingProgressResolver = authorized<
|
|||
}
|
||||
try {
|
||||
if (force) {
|
||||
// update reading progress without checking the current value
|
||||
// update reading progress without checking the current value, also
|
||||
// clear any cached values.
|
||||
await clearCachedReadingPosition(uid, id)
|
||||
|
||||
const updatedItem = await updateLibraryItem(
|
||||
id,
|
||||
{
|
||||
|
|
@ -660,6 +664,17 @@ export const saveArticleReadingProgressResolver = authorized<
|
|||
undefined,
|
||||
uid
|
||||
)
|
||||
if (updatedItem) {
|
||||
updatedItem.readAt = new Date()
|
||||
updatedItem.readingProgressBottomPercent = readingProgressPercent
|
||||
if (readingProgressTopPercent) {
|
||||
updatedItem.readingProgressTopPercent = readingProgressTopPercent
|
||||
}
|
||||
if (readingProgressAnchorIndex) {
|
||||
updatedItem.readingProgressLastReadAnchor =
|
||||
readingProgressAnchorIndex
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// update reading progress only if the current value is lower
|
||||
updatedItem = await updateLibraryItemReadingProgress(
|
||||
|
|
|
|||
Loading…
Reference in a new issue