Merge pull request #4391 from urbit/lf/loading-fix

ViewProfile: fix incorrect loading conditional
This commit is contained in:
Liam Fitzgerald 2021-02-09 13:31:27 +10:00 committed by GitHub
commit 0350311882
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 6 deletions

View File

@ -1,5 +1,6 @@
/- *resource
/+ store=contact-store, contact, default-agent, verb, dbug, pull-hook
/+ store=contact-store, contact, default-agent, verb, dbug, pull-hook, agentio
/+ grpl=group
~% %contact-pull-hook-top ..part ~
|%
+$ card card:agent:gall
@ -23,11 +24,26 @@
def ~(. (default-agent this %|) bowl)
dep ~(. (default:pull-hook this config) bowl)
con ~(. contact bowl)
io ~(. agentio bowl)
grp ~(. grpl bowl)
::
++ on-init on-init:def
++ on-init
^- (quip card _this)
:_ this
(poke-self:pass:io noun+!>(%upgrade))^~
++ on-save !>(~)
++ on-load on-load:def
++ on-poke on-poke:def
++ on-poke
|= [=mark =vase]
^- (quip card _this)
?. ?=(%noun mark) (on-poke:def mark vase)
:_ this
%+ murn ~(tap in scry-groups:grp)
|= rid=resource
?: =(our.bowl entity.rid) ~
`(poke-self:pass:io pull-hook-action+!>([%add [entity .]:rid]))
::
++ on-peek on-peek:def
++ on-arvo on-arvo:def
++ on-fail on-fail:def

View File

@ -23,6 +23,11 @@
^- card
(poke [our.bowl app] cage)
::
++ poke-self
|= =cage
^- card
(poke-our dap.bowl cage)
::
++ arvo
|= =note-arvo
^- card

View File

@ -74,6 +74,7 @@ export default class MetadataApi extends BaseApi<StoreState> {
tempChannel.subscribe(window.ship, "metadata-pull-hook", `/preview${group}`,
(err) => {
console.error(err);
reject(err);
tempChannel.delete();
},

View File

@ -1,4 +1,5 @@
import React, {useEffect, useState} from "react";
import _ from 'lodash';
import { Sigil } from "~/logic/lib/sigil";
import {
@ -25,10 +26,21 @@ export function ViewProfile(props: any) {
useEffect(() => {
(async () => {
setPreviews(
await Promise.all((contact?.groups || []).map(g => api.metadata.preview(g)))
_.compact(
await Promise.all(
(contact?.groups || []).map(g => api.metadata.preview(g)
.catch(() => null)
)
)
)
);
})();
}, [contact?.groups])
return () => {
setPreviews([]);
}
}, [ship]);
return (
<>
<Row
@ -63,7 +75,7 @@ export function ViewProfile(props: any) {
{ (contact?.groups || []).length > 0 && (
<Col gapY="3" my="3" alignItems="center">
<Text fontWeight="medium">Pinned Groups</Text>
{previews.length > 0 ? (
{previews.length === 0 ? (
<LoadingSpinner />
) : (
<Row justifyContent="center" gapX="3">