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 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) {
|
() => {
|
||||||
content = <Empty/>
|
if(tweets.length === 0) {
|
||||||
}
|
return <Empty/>
|
||||||
else {
|
}
|
||||||
content = tweets.map(tweet => <SummaryTweet key={tweet["snowflake"]} tweet={tweet}/>)
|
else {
|
||||||
}
|
return tweets.map(tweet => <SummaryTweet key={tweet["snowflake"]} tweet={tweet}/>)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[tweets]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BoxFullScrollable header={strings.tweets} {...props}>
|
<BoxFullScrollable header={strings.tweets} {...props}>
|
||||||
|
|
Loading…
Reference in a new issue