From f08202d592d68d4caa90de40dc3df76fdeab897b Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Thu, 20 Nov 2025 22:58:44 +0000 Subject: [PATCH] fix: Always fetch full story and update existing in feed Co-authored-by: aider (gemini/gemini-2.5-pro) --- webclient/src/Feed.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/webclient/src/Feed.js b/webclient/src/Feed.js index 90ef3d9..1e12d69 100644 --- a/webclient/src/Feed.js +++ b/webclient/src/Feed.js @@ -21,13 +21,8 @@ function Feed({ updateCache }) { if (!updated) return; let currentStories = Array.isArray(stories) ? [...stories] : []; - const existingStoryIds = new Set(currentStories.map(s => s.id)); for (const newStory of [...newApiStories].reverse()) { - if (existingStoryIds.has(newStory.id)) { - continue; - } - try { const storyRes = await fetch('/api/' + newStory.id); if (!storyRes.ok) throw new Error('Story fetch failed'); @@ -38,6 +33,10 @@ function Feed({ updateCache }) { console.log('Preloaded story:', fullStory.id, fullStory.title); updateCache(fullStory.id, fullStory); + const existingStoryIndex = currentStories.findIndex(s => s.id === newStory.id); + if (existingStoryIndex > -1) { + currentStories.splice(existingStoryIndex, 1); + } currentStories.unshift(newStory); } catch (error) { console.log('Skipping story due to fetch error', newStory.id, error);