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 /- *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 ~ ~% %contact-pull-hook-top ..part ~
|% |%
+$ card card:agent:gall +$ card card:agent:gall
@ -23,11 +24,26 @@
def ~(. (default-agent this %|) bowl) def ~(. (default-agent this %|) bowl)
dep ~(. (default:pull-hook this config) bowl) dep ~(. (default:pull-hook this config) bowl)
con ~(. contact 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-save !>(~)
++ on-load on-load:def ++ 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-peek on-peek:def
++ on-arvo on-arvo:def ++ on-arvo on-arvo:def
++ on-fail on-fail:def ++ on-fail on-fail:def

View File

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

View File

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

View File

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