1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-22 04:54:18 +00:00

🔧 Immensely improve performance in the RepositoryViewer

This commit is contained in:
Steffo 2021-05-23 16:07:18 +02:00
parent 6af52643d1
commit 2c57bd0238
Signed by: steffo
GPG key ID: 6965406171929D01

View file

@ -1,4 +1,4 @@
import React from "react" import React, { useMemo } from "react"
import BoxFullScrollable from "../base/BoxFullScrollable" import BoxFullScrollable from "../base/BoxFullScrollable"
import SummaryTweet from "./SummaryTweet" import SummaryTweet from "./SummaryTweet"
import Empty from "./Empty" import Empty from "./Empty"
@ -18,13 +18,18 @@ export default function BoxRepositoryTweets({ ...props }) {
const strings = useStrings() const strings = useStrings()
const { tweets } = useRepositoryViewer() const { tweets } = useRepositoryViewer()
let content const content = useMemo(
() => {
if(tweets.length === 0) { if(tweets.length === 0) {
content = <Empty/> return <Empty/>
} }
else { else {
content = tweets.map(tweet => <SummaryTweet key={tweet["snowflake"]} tweet={tweet}/>) return tweets.map(tweet => <SummaryTweet key={tweet["snowflake"]} tweet={tweet}/>)
} }
},
[tweets]
)
return ( return (
<BoxFullScrollable header={strings.tweets} {...props}> <BoxFullScrollable header={strings.tweets} {...props}>