Preserve feed scroll position across navigation

Keep Feed component mounted (hidden via CSS) instead of unmounting
when navigating to threads/profiles/etc. Back button now returns to
the exact scroll position in the feed.
This commit is contained in:
Jure
2026-03-15 19:44:10 +01:00
parent 35fac6bab9
commit 17011252d6
2 changed files with 4 additions and 1 deletions

View File

@@ -62,7 +62,9 @@ function App() {
<div className="flex flex-1 min-h-0">
<Sidebar />
<main className="flex-1 min-w-0">
{currentView === "feed" && <Feed />}
<div className={currentView === "feed" ? "contents" : "hidden"}>
<Feed />
</div>
{currentView === "search" && <SearchView />}
{currentView === "relays" && <RelaysView />}
{currentView === "settings" && <SettingsView />}

View File

@@ -24,6 +24,7 @@ export function Feed() {
connect().then(() => loadFeed());
}, []);
useEffect(() => {
if (tab === "following" && loggedIn && follows.length > 0) {
loadFollowFeed();