From faab9a2cbc06e82f2ef09c1dadce6a94b34d1802 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Sun, 14 Jun 2020 03:08:40 +0300
Subject: fix: always render same feed, add TODO

---
 src/Feed/Feed.tsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/Feed/Feed.tsx')

diff --git a/src/Feed/Feed.tsx b/src/Feed/Feed.tsx
index 21bda5e..1b2a81e 100644
--- a/src/Feed/Feed.tsx
+++ b/src/Feed/Feed.tsx
@@ -20,9 +20,9 @@ const Feed: React.FC<PropTypes> = ({ page }) => {
   const [polls, setPolls] = useState<Poll[]>([]);
   const classes = useStyles();
 
-  let endpoint: string;
+  let endpoint = '/polls';
+  // TODO: Make this work
   if (page === 'feed') endpoint = '/polls';
-  else if (page === 'profiles') endpoint = '/profiles';
 
   useEffect(() => {
     get(endpoint).then(response => {
-- 
cgit v1.2.3


From 0308460d896966a9fe5e510926f44bac112923bb Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Sun, 14 Jun 2020 15:38:55 +0300
Subject: fix: add unique key prop to polls

---
 src/Feed/Feed.tsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/Feed/Feed.tsx')

diff --git a/src/Feed/Feed.tsx b/src/Feed/Feed.tsx
index 1b2a81e..d7bfce1 100644
--- a/src/Feed/Feed.tsx
+++ b/src/Feed/Feed.tsx
@@ -28,11 +28,11 @@ const Feed: React.FC<PropTypes> = ({ page }) => {
     get(endpoint).then(response => {
       setPolls(response.data);
     });
-  }, []);
+  }, [endpoint]);
 
   return (
     <div className={classes.root}>
-      {polls.map(poll => <PollCard poll={poll} />)}
+      {polls.map(poll => <PollCard poll={poll} key={poll._id} />)}
     </div>
   );
 };
-- 
cgit v1.2.3

