From ff0230b77fdfd941966ecd5912044558f9362205 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Wed, 24 Mar 2021 01:53:33 +1100 Subject: [PATCH] Tested the new libs --- client/components/panels/news-feed.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/components/panels/news-feed.jsx b/client/components/panels/news-feed.jsx index 55ffa1d..d2389c8 100644 --- a/client/components/panels/news-feed.jsx +++ b/client/components/panels/news-feed.jsx @@ -1,11 +1,15 @@ import React, { useState, useEffect } from 'react'; import dateFormat from 'dateformat'; -//DOCS: props.uri is the address of a live news-server const NewsFeed = props => { const [articles, setArticles] = useState([]); useEffect(async () => { + if (articles.length != 0) { //BUGFIX: There's an extra render called on unmounted components somewhere + return; + } + + //NOTE: could this be improved with useMemo? const result = await fetch(`${process.env.NEWS_URI}/news`, { method: 'GET', headers: {