fix(search): refresh feed after returning from YouTube search

A live search ingests new catalog videos, but the normal feed query was disabled during
search mode and kept its pre-search cache — so 'Back to feed' showed the stale (often empty)
result until a manual reload. Drop the feed / feed-count / facets caches when leaving search
mode so the feed re-fetches fresh and immediately reflects the just-ingested videos.
This commit is contained in:
npeter83 2026-06-29 02:40:32 +02:00
parent a7a72c4c7e
commit ed21b93320

View file

@ -284,7 +284,15 @@ export default function Feed({
<div className="p-4"> <div className="p-4">
<div className="flex items-center gap-2 flex-wrap pb-3 mb-1 border-b border-border"> <div className="flex items-center gap-2 flex-wrap pb-3 mb-1 border-b border-border">
<button <button
onClick={() => setYtSearch(null)} onClick={() => {
// The search just ingested new catalog videos, so the normal feed (which was
// disabled and still holds its pre-search cache) is stale. Drop those caches so
// it re-fetches fresh on return instead of showing the old (often empty) result.
setYtSearch(null);
qc.removeQueries({ queryKey: ["feed"] });
qc.removeQueries({ queryKey: ["feed-count"] });
qc.removeQueries({ queryKey: ["facets"] });
}}
className="inline-flex items-center gap-1.5 text-sm text-muted hover:text-accent transition shrink-0" className="inline-flex items-center gap-1.5 text-sm text-muted hover:text-accent transition shrink-0"
> >
<ArrowLeft className="w-4 h-4" /> <ArrowLeft className="w-4 h-4" />