diff --git a/apps/tlon-web/src/components/Sidebar/Sidebar.tsx b/apps/tlon-web/src/components/Sidebar/Sidebar.tsx index 8b96ddd398..107b34599f 100644 --- a/apps/tlon-web/src/components/Sidebar/Sidebar.tsx +++ b/apps/tlon-web/src/components/Sidebar/Sidebar.tsx @@ -260,8 +260,6 @@ const Sidebar = React.memo(() => { ); }); -Sidebar.displayName = 'Sidebar'; - const SidebarTopSection = React.memo( ({ title, @@ -292,6 +290,4 @@ const SidebarTopSection = React.memo( } ); -SidebarTopSection.displayName = 'SidebarTopSection'; - export default Sidebar; diff --git a/apps/tlon-web/src/state/unreads.ts b/apps/tlon-web/src/state/unreads.ts index 43d6749f23..4232d266f4 100644 --- a/apps/tlon-web/src/state/unreads.ts +++ b/apps/tlon-web/src/state/unreads.ts @@ -105,43 +105,15 @@ function sumChildren( return acc; } - const { - count: grandChildCount, - notify: grandChildNotify, - status: grandChildStatus, - } = Object.entries(unreads[key].children || {}).reduce( - (grandAcc, [grandKey, grandChild]) => { - const grandChildStatus = unreads[grandKey]?.status; - const grandChildNotify = unreads[grandKey]?.notify; - - return { - count: grandChildNotify - ? grandAcc.count + grandChild.count - : grandAcc.count, - notify: grandAcc.notify || grandChildNotify, - status: grandChildNotify - ? combineStatus(childStatus, grandChildStatus || 'read') - : grandAcc.status, - }; - }, - { - count: 0, - notify: false, - status: 'read', - } - ); - - if (childStatus === 'unread' || grandChildStatus === 'unread') { + if (childStatus === 'unread') { status = 'unread'; } else if (childStatus === 'seen' && status === 'read') { status = 'seen'; } return { - count: !sumCounts - ? acc.count - : acc.count + (child.unread?.count || 0) + grandChildCount, - notify: acc.notify || Boolean(child.notify) || grandChildNotify, + count: !sumCounts ? acc.count : acc.count + (child.unread?.count || 0), + notify: acc.notify || Boolean(child.notify), status, }; }, @@ -300,17 +272,6 @@ export const useUnreadsStore = create((set, get) => ({ ? childSrc.parents : [...childSrc.parents, key], }; - - const parent = draft.sources[key]; - const childSummary = summaries[child]; - - draft.sources[key] = { - ...parent, - children: { - ...parent.children, - [child]: childSummary, - }, - }; }); }); })