fix(feed): clear optimistic overrides on refetch
The feed kept per-video optimistic status overrides until filters changed, so a status reverted elsewhere (e.g. Unwatch from the notification center) was masked by the stale override and stayed filtered out of the current view. Also clear overrides when fresh feed data arrives — the server is then authoritative.
This commit is contained in:
parent
1a704a2de4
commit
318649ca83
1 changed files with 5 additions and 0 deletions
|
|
@ -42,7 +42,12 @@ export default function Feed({
|
||||||
getNextPageParam: (last) => (last.has_more ? last.offset + last.limit : undefined),
|
getNextPageParam: (last) => (last.has_more ? last.offset + last.limit : undefined),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Drop optimistic status overrides when filters change OR fresh server data
|
||||||
|
// arrives — after a refetch the server is authoritative, so a stale override
|
||||||
|
// (e.g. a video reverted to "new" from the notification center) won't keep it
|
||||||
|
// filtered out of the current view.
|
||||||
useEffect(() => setOverrides({}), [filters]);
|
useEffect(() => setOverrides({}), [filters]);
|
||||||
|
useEffect(() => setOverrides({}), [query.dataUpdatedAt]);
|
||||||
|
|
||||||
const countQuery = useQuery({
|
const countQuery = useQuery({
|
||||||
queryKey: ["feed-count", filters],
|
queryKey: ["feed-count", filters],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue