From 6f751a4a21796652d8cfc38b6209d7bfb4016ade Mon Sep 17 00:00:00 2001
From: Stephen Zhou <38493346+hyoban@users.noreply.github.com>
Date: Mon, 25 Nov 2024 18:49:10 +0800
Subject: [PATCH] fix: sync active view after close sheet
---
.../layouts/EntryListHeader.mobile.tsx | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/apps/renderer/src/modules/entry-column/layouts/EntryListHeader.mobile.tsx b/apps/renderer/src/modules/entry-column/layouts/EntryListHeader.mobile.tsx
index 014b6792b..a79c0f0b2 100644
--- a/apps/renderer/src/modules/entry-column/layouts/EntryListHeader.mobile.tsx
+++ b/apps/renderer/src/modules/entry-column/layouts/EntryListHeader.mobile.tsx
@@ -12,12 +12,14 @@ import * as React from "react"
import { useTranslation } from "react-i18next"
import { setGeneralSetting, useGeneralSettingKey } from "~/atoms/settings/general"
+import { getSidebarActiveView } from "~/atoms/sidebar"
import { useWhoami } from "~/atoms/user"
import { HeaderTopReturnBackButton } from "~/components/mobile/button"
import { FEED_COLLECTION_LIST, ROUTE_FEED_IN_LIST } from "~/constants"
import { LOGO_MOBILE_ID } from "~/constants/dom"
import { shortcuts } from "~/constants/shortcuts"
-import { useRouteParams } from "~/hooks/biz/useRouteParams"
+import { navigateEntry } from "~/hooks/biz/useNavigateEntry"
+import { getRouteParams, useRouteParams } from "~/hooks/biz/useRouteParams"
import { FeedColumnMobile } from "~/modules/app-layout/feed-column/mobile"
import { useRefreshFeedMutation } from "~/queries/feed"
import { useFeedById, useFeedHeaderTitle } from "~/store/feed"
@@ -177,6 +179,18 @@ const FollowSubscriptionButton = () => {
content={}
modalClassName="bg-background pt-4 h-[calc(100svh-3rem)]"
contentClassName="p-0 overflow-visible"
+ onOpenChange={(isOpen) => {
+ if (!isOpen) {
+ const sidebarActiveView = getSidebarActiveView()
+ const { view } = getRouteParams()
+ if (sidebarActiveView !== view) {
+ navigateEntry({
+ view: sidebarActiveView,
+ feedId: null,
+ })
+ }
+ }
+ }}
>