mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
Merge pull request #19 from Re-Ignited-Development/bug/new-tweet-laggy
[Bug] optimize tweet list
This commit is contained in:
1 file changed
+3
-2
@@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState, memo } from "react";
|
||||||
|
|
||||||
import { List } from "../../../../ui/components/List";
|
import { List } from "../../../../ui/components/List";
|
||||||
import Tweet from "./Tweet";
|
import Tweet from "./Tweet";
|
||||||
@@ -21,6 +21,7 @@ export function TweetList({ tweets }) {
|
|||||||
// another flash to the tweets screen.
|
// another flash to the tweets screen.
|
||||||
const hasLoaded = tweets && minimumLoadPassed;
|
const hasLoaded = tweets && minimumLoadPassed;
|
||||||
|
|
||||||
|
|
||||||
if (!hasLoaded) return <TweetSkeletonList />;
|
if (!hasLoaded) return <TweetSkeletonList />;
|
||||||
return (
|
return (
|
||||||
<List>
|
<List>
|
||||||
@@ -31,4 +32,4 @@ export function TweetList({ tweets }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default TweetList;
|
export default memo(TweetList); // only re-render if our tweets change
|
||||||
Reference in new issue
Block a user