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:
parent
6af52643d1
commit
2c57bd0238
1 changed files with 13 additions and 8 deletions
|
@ -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 = <Empty/>
|
||||
}
|
||||
else {
|
||||
content = tweets.map(tweet => <SummaryTweet key={tweet["snowflake"]} tweet={tweet}/>)
|
||||
}
|
||||
const content = useMemo(
|
||||
() => {
|
||||
if(tweets.length === 0) {
|
||||
return <Empty/>
|
||||
}
|
||||
else {
|
||||
return tweets.map(tweet => <SummaryTweet key={tweet["snowflake"]} tweet={tweet}/>)
|
||||
}
|
||||
},
|
||||
[tweets]
|
||||
)
|
||||
|
||||
|
||||
return (
|
||||
<BoxFullScrollable header={strings.tweets} {...props}>
|
||||
|
|
Loading…
Reference in a new issue