mirror of
https://github.com/urbit/shrub.git
synced 2024-12-01 06:35:32 +03:00
parent
ed4fa6a7ae
commit
6df2d349d3
@ -1,6 +1,6 @@
|
||||
import { Col, Row, Text } from '@tlon/indigo-react';
|
||||
import { Association, Graph, GraphNode } from '@urbit/api';
|
||||
import React, { useCallback, useState, useMemo } from 'react';
|
||||
import { Association, Graph, GraphNode, markEachAsRead } from '@urbit/api';
|
||||
import React, { useCallback, useState, useMemo, useEffect } from 'react';
|
||||
import _ from 'lodash';
|
||||
import { useResize } from '~/logic/lib/useResize';
|
||||
import { LinkBlockItem } from './LinkBlockItem';
|
||||
@ -9,6 +9,8 @@ import useLocalState from '~/logic/state/local';
|
||||
import BigIntOrderedMap from '@urbit/api/lib/BigIntOrderedMap';
|
||||
import bigInt from 'big-integer';
|
||||
import VirtualScroller from '~/views/components/VirtualScroller';
|
||||
import airlock from '~/logic/api';
|
||||
import useHarkState from '~/logic/state/hark';
|
||||
|
||||
export interface LinkBlocksProps {
|
||||
graph: Graph;
|
||||
@ -40,6 +42,14 @@ export function LinkBlocks(props: LinkBlocksProps) {
|
||||
)
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const { unreads } = useHarkState
|
||||
.getState().unreads.graph?.[association.resource]?.['/'];
|
||||
Array.from((unreads as Set<string>)).forEach((u) => {
|
||||
airlock.poke(markEachAsRead(association.resource, '/', u));
|
||||
});
|
||||
}, [association.resource]);
|
||||
|
||||
const orm = useMemo(() => {
|
||||
const nodes = [null, ...Array.from(props.graph)];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user