Skip to content

Commit

Permalink
fix: can't toggle the expanded state of automatic grouping by feed URL
Browse files Browse the repository at this point in the history
  • Loading branch information
Przeblysk committed Sep 29, 2024
1 parent bec523f commit 374ef0a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions apps/renderer/src/modules/feed-column/category.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ function FeedCategoryImpl({ data: ids, view, categoryOpenStateData }: FeedCatego
const folderName = subscription?.category || subscription.defaultCategory

const showCollapse = sortByUnreadFeedList.length > 1 || subscription?.category
const open = subscription?.category ? categoryOpenStateData[subscription?.category] : true
const open = folderName ? categoryOpenStateData[folderName] : true

const shouldOpen = useRouteParamsSelector(
(s) => typeof s.feedId === "string" && ids.includes(s.feedId),
)
const shouldOpen =
useRouteParamsSelector((s) => typeof s.feedId === "string" && ids.includes(s.feedId)) ||
ids.length === 1

const itemsRef = useRef<HTMLDivElement>(null)

Expand Down
7 changes: 4 additions & 3 deletions apps/renderer/src/store/subscription/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class SubscriptionActions {
const transformedData = morphResponseData(res.data)

this.upsertMany(transformedData)
this.updateCategoryOpenState(transformedData.filter((s) => s.category))
this.updateCategoryOpenState(transformedData.filter((s) => s.category || s.defaultCategory))
feedActions.upsertMany(res.data.map((s) => ("feeds" in s ? s.feeds : s.lists)))

return res.data
Expand All @@ -143,8 +143,9 @@ class SubscriptionActions {
set((state) =>
produce(state, (state) => {
subscriptions.forEach((subscription) => {
state.categoryOpenStateByView[subscription.view][subscription.category] =
state.categoryOpenStateByView[subscription.view][subscription.category] || false
const folderName = subscription.category || subscription.defaultCategory
state.categoryOpenStateByView[subscription.view][folderName] =
state.categoryOpenStateByView[subscription.view][folderName] || false
return state
})
}),
Expand Down

0 comments on commit 374ef0a

Please sign in to comment.