From 34bbb5051afbe2b6394510b4d4ed14566313d4b0 Mon Sep 17 00:00:00 2001 From: hugo Date: Thu, 12 Feb 2026 12:25:16 +0100 Subject: [PATCH] fix: clicking posts in filtered lists --- src/renderer/components/Editor/Editor.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/renderer/components/Editor/Editor.tsx b/src/renderer/components/Editor/Editor.tsx index a32deda..f929609 100644 --- a/src/renderer/components/Editor/Editor.tsx +++ b/src/renderer/components/Editor/Editor.tsx @@ -1028,13 +1028,20 @@ export const Editor: React.FC = () => { } }, [activeView, selectedMediaId, media, isLoading, setSelectedMedia]); - // Close tab if the item doesn't exist anymore + // Close tab if the item doesn't exist anymore, or fetch it if not yet loaded useEffect(() => { if (activeTab && !isLoading) { if (activeTab.type === 'post') { const postExists = posts.some(p => p.id === activeTab.id); if (!postExists) { - closeTab(activeTab.id); + // Post might not be loaded yet (pagination / filtered view) — try fetching it + window.electronAPI?.posts.get(activeTab.id).then((post) => { + if (post) { + useAppStore.getState().addPost(post as PostData); + } else { + closeTab(activeTab.id); + } + }); } } else if (activeTab.type === 'media') { const mediaExists = media.some(m => m.id === activeTab.id);