Parcourir la source

fix to handle missing member data

Joystream Stats il y a 3 ans
Parent
commit
dcfae18563

+ 1 - 1
src/components/Dashboard/Council.tsx

@@ -52,7 +52,7 @@ const CouncilGrid = (props: {
 
   const sortCouncil = (consuls) =>
     consuls.sort((a, b) =>
-      (a.member.handle || "").localeCompare(b.member.handle || "")
+      (a.member?.handle || "").localeCompare(b.member?.handle || "")
     );
 
   return (

+ 1 - 1
src/components/Forum/LatestPost.tsx

@@ -27,7 +27,7 @@ const LatestPost = (props: {
     >
       <div className="mb-2">
         {created.isValid() ? created.fromNow() : <span />}
-        <User key={author.id} id={author.id} handle={author.handle} />
+        <User key={author?.id} id={author?.id} handle={author?.handle} />
         posted in
         <Link
           to={`/forum/threads/${threadId}`}

+ 1 - 1
src/components/Proposals/Row.tsx

@@ -103,7 +103,7 @@ const ProposalRow = (props: {
   const classes = useStyles();
 
   const hasToVote = council?.consuls?.filter(
-    (c) => !votes.find((v) => v.member.handle === c.member.handle)
+    (c) => !votes.find((v) => v.member?.handle === c.member?.handle)
   );
 
   return (

+ 1 - 0
src/components/Votes.tsx

@@ -47,6 +47,7 @@ const VoteBubble = (props: {
   count: number;
 }) => {
   const { detailed, vote } = props;
+  if (!vote.member) return <div />;
   const handle = vote.member.handle;
   return (
     <Button className="btn-sm p-1" variant={voteStyles[vote.vote]}>