From 2c57bd0238aa75a8c2836e764495526ef4579b58 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 23 May 2021 16:07:18 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Immensely=20improve=20performanc?= =?UTF-8?q?e=20in=20the=20RepositoryViewer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interactive/BoxRepositoryTweets.js | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/nest_frontend/components/interactive/BoxRepositoryTweets.js b/nest_frontend/components/interactive/BoxRepositoryTweets.js index 822cba7..953bfd5 100644 --- a/nest_frontend/components/interactive/BoxRepositoryTweets.js +++ b/nest_frontend/components/interactive/BoxRepositoryTweets.js @@ -1,4 +1,4 @@ -import React from "react" +import React, { useMemo } from "react" import BoxFullScrollable from "../base/BoxFullScrollable" import SummaryTweet from "./SummaryTweet" import Empty from "./Empty" @@ -18,13 +18,18 @@ export default function BoxRepositoryTweets({ ...props }) { const strings = useStrings() const { tweets } = useRepositoryViewer() - let content - if(tweets.length === 0) { - content = - } - else { - content = tweets.map(tweet => ) - } + const content = useMemo( + () => { + if(tweets.length === 0) { + return + } + else { + return tweets.map(tweet => ) + } + }, + [tweets] + ) + return (