Merge pull request #4911 from urbit/lf/bag-of-grab

interface: misc grabbag
This commit is contained in:
matildepark 2021-05-18 12:30:33 -04:00 committed by GitHub
commit e80cd1ceb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 6 deletions

View File

@ -328,6 +328,7 @@ export default class GraphApi extends BaseApi<StoreState> {
async getNewest(ship: string, resource: string, count: number, index = '') {
const data = await this.scry<any>('graph-store', `/newest/${ship}/${resource}/${count}${index}`);
data['graph-update'].fetch = true;
this.store.handleEvent({ data });
}
@ -335,7 +336,7 @@ export default class GraphApi extends BaseApi<StoreState> {
const idx = index.split('/').map(decToUd).join('/');
const data = await this.scry<any>('graph-store',
`/node-siblings/older/${ship}/${resource}/${count}${idx}`
);
);
this.store.handleEvent({ data });
}

View File

@ -180,9 +180,15 @@ const addNodes = (json, state) => {
const resource = data.resource.ship + '/' + data.resource.name;
if (!(resource in state.graphs)) {
state.graphs[resource] = new BigIntOrderedMap();
if(json.fetch) {
state.graphs[resource] = new BigIntOrderedMap();
} else {
// ignore updates until we load backlog deliberately, to avoid
// unnecessary memory usage
return state;
}
}
if (!(resource in state.graphTimesentMap)) {
state.graphTimesentMap[resource] = {};
}

View File

@ -58,7 +58,7 @@ export default function Groups(props: GroupsProps & Parameters<typeof Box>[0]) {
const notCount = graphNotifications(path);
return (
<Group
key={group.metadata.title}
key={group?.group}
updates={notCount}
first={index === 0}
unreads={unreadCount}

View File

@ -43,7 +43,7 @@ function RecentGroups(props: { recent: string[] }) {
</Box>
{props.recent.filter((e) => {
return (e in associations?.groups);
}).slice(1, 5).map((g) => {
}).slice(0, 4).map((g) => {
const assoc = associations.groups[g];
const color = uxToHex(assoc?.metadata?.color || '0x0');
return (

View File

@ -53,7 +53,9 @@ export function GroupsPane(props: GroupsPaneProps) {
if (workspace.type !== 'group') {
return;
}
setRecentGroups(gs => _.uniq([workspace.group, ...gs]));
return () => {
setRecentGroups(gs => _.uniq([workspace.group, ...gs]));
}
}, [workspace]);
if (!(associations && (groupPath ? groupPath in groups : true))) {