Merge pull request #4216 from urbit/la/fix-4164

4164: fixes display issue with jobs / gigs based on faulty hark state
This commit is contained in:
L 2021-01-06 12:24:36 -06:00 committed by GitHub
commit 2725f5b2c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,16 +46,17 @@ export function useGraphModule(
): SidebarAppConfig {
const getStatus = useCallback(
(s: string) => {
const unreads = graphUnreads?.[s]?.['/']?.unreads;
if(typeof unreads === 'number' ? unreads > 0 : unreads?.size ?? 0 > 0) {
return 'unread';
}
const [, , host, name] = s.split("/");
const graphKey = `${host.slice(1)}/${name}`;
if (!graphKeys.has(graphKey)) {
return "unsubscribed";
}
const unreads = graphUnreads?.[s]?.['/']?.unreads;
if (typeof unreads === 'number' ? unreads > 0 : unreads?.size ?? 0 > 0) {
return 'unread';
}
return undefined;
},
[graphs, graphKeys, graphUnreads]