mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
the "new-feed-entries" websocket event no longer needs to reload the entire tree
This commit is contained in:
@@ -26,6 +26,22 @@ export const treeSlice = createSlice({
|
||||
toggleSidebar: state => {
|
||||
state.sidebarVisible = !state.sidebarVisible
|
||||
},
|
||||
incrementUnreadCount: (
|
||||
state,
|
||||
action: PayloadAction<{
|
||||
feedId: number
|
||||
amount: number
|
||||
}>
|
||||
) => {
|
||||
if (!state.rootCategory) return
|
||||
visitCategoryTree(state.rootCategory, c =>
|
||||
c.feeds
|
||||
.filter(f => f.id === action.payload.feedId)
|
||||
.forEach(f => {
|
||||
f.unread += action.payload.amount
|
||||
})
|
||||
)
|
||||
},
|
||||
},
|
||||
extraReducers: builder => {
|
||||
builder.addCase(reloadTree.fulfilled, (state, action) => {
|
||||
@@ -53,4 +69,4 @@ export const treeSlice = createSlice({
|
||||
},
|
||||
})
|
||||
|
||||
export const { setMobileMenuOpen, toggleSidebar } = treeSlice.actions
|
||||
export const { setMobileMenuOpen, toggleSidebar, incrementUnreadCount } = treeSlice.actions
|
||||
|
||||
Reference in New Issue
Block a user