From d4389ce2d3281c29ab742c9da3cdac948b563f2f Mon Sep 17 00:00:00 2001 From: Innei Date: Tue, 4 Nov 2025 21:42:44 +0800 Subject: [PATCH] fix(view-all): can not move to category in all view Refactored the FeedCategoryImpl function to replace the 'view' prop with 'viewOnRoute' for better clarity and consistency. Adjusted related subscription action calls to utilize the new prop, ensuring proper state management and navigation behavior. Signed-off-by: Innei --- .../subscription-column/FeedCategory.tsx | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/apps/desktop/layer/renderer/src/modules/subscription-column/FeedCategory.tsx b/apps/desktop/layer/renderer/src/modules/subscription-column/FeedCategory.tsx index 3d118b5b0..3722666e7 100644 --- a/apps/desktop/layer/renderer/src/modules/subscription-column/FeedCategory.tsx +++ b/apps/desktop/layer/renderer/src/modules/subscription-column/FeedCategory.tsx @@ -53,7 +53,11 @@ interface FeedCategoryProps { categoryOpenStateData: Record } -function FeedCategoryImpl({ data: ids, view, categoryOpenStateData }: FeedCategoryProps) { +function FeedCategoryImpl({ + data: ids, + view: viewOnRoute, + categoryOpenStateData, +}: FeedCategoryProps) { const { t } = useTranslation() const sortByUnreadFeedList = useSortedIdsByUnread(ids) @@ -61,6 +65,8 @@ function FeedCategoryImpl({ data: ids, view, categoryOpenStateData }: FeedCatego const navigate = useNavigateEntry() const subscription = useSubscriptionByFeedId(ids[0]!)! + + const { view } = subscription const autoGroup = useGeneralSettingSelector((state) => state.autoGroup) const folderName = subscription?.category || (autoGroup ? getDefaultCategory(subscription) : subscription.feedId) @@ -77,16 +83,17 @@ function FeedCategoryImpl({ data: ids, view, categoryOpenStateData }: FeedCatego const setOpen = useCallback( (next: boolean) => { - if (view !== undefined && folderName) { - subscriptionActions.changeCategoryOpenState(view, folderName, next) + if (viewOnRoute !== undefined && folderName) { + subscriptionActions.changeCategoryOpenState(viewOnRoute, folderName, next) } }, - [folderName, view], + [folderName, viewOnRoute], ) const shouldOpen = useRouteParamsSelector( (s) => typeof s.feedId === "string" && ids.includes(s.feedId), ) + const scroller = useScrollViewElement() const scrollerRef = useRefValue(scroller) useEffect(() => { @@ -122,7 +129,7 @@ function FeedCategoryImpl({ data: ids, view, categoryOpenStateData }: FeedCatego setCategoryActive() } if (view !== undefined && folderName) { - subscriptionActions.toggleCategoryOpenState(view, folderName) + subscriptionActions.toggleCategoryOpenState(viewOnRoute, folderName) } }, ) @@ -130,7 +137,7 @@ function FeedCategoryImpl({ data: ids, view, categoryOpenStateData }: FeedCatego const handleCollapseButtonClick = useEventCallback((e: React.MouseEvent) => { e.stopPropagation() if (view !== undefined && folderName) { - subscriptionActions.toggleCategoryOpenState(view, folderName) + subscriptionActions.toggleCategoryOpenState(viewOnRoute, folderName) } }) @@ -139,7 +146,7 @@ function FeedCategoryImpl({ data: ids, view, categoryOpenStateData }: FeedCatego navigate({ entryId: null, folderName, - view, + view: viewOnRoute, }) } }