From a68dccd7cfac572a925b895bc34620933e28a186 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Mon, 15 Apr 2024 21:37:03 +0800 Subject: [PATCH] Fix rerender bug with followed hashtag parent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And… somehow memoize it? --- src/components/status.jsx | 41 +++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/src/components/status.jsx b/src/components/status.jsx index a72182c4..4eff323d 100644 --- a/src/components/status.jsx +++ b/src/components/status.jsx @@ -407,26 +407,29 @@ function Status({ } // Check followedTags - const FollowedTagsParent = ({ children }) => ( -
-
- {' '} - {snapStates.statusFollowedTags[sKey].slice(0, 3).map((tag) => ( - - {tag} - - ))} + const FollowedTagsParent = useCallback( + ({ children }) => ( +
+
+ {' '} + {snapStates.statusFollowedTags[sKey].slice(0, 3).map((tag) => ( + + {tag} + + ))} +
+ {children}
- {children} -
+ ), + [sKey, instance, snapStates.statusFollowedTags[sKey]], ); const StatusParent = showFollowedTags && !!snapStates.statusFollowedTags[sKey]?.length