Skip to content

Commit

Permalink
CW-some-stream-disappear Fixed Render fewer hooks issue
Browse files Browse the repository at this point in the history
  • Loading branch information
MeyerPV committed Aug 5, 2024
1 parent a6577d8 commit 0e0bde0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
26 changes: 14 additions & 12 deletions src/pages/common/components/FeedItem/FeedItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,6 @@ const FeedItem = forwardRef<FeedItemRef, FeedItemProps>((props, ref) => {
onFeedItemUnfollowed,
]);

if (
shouldCheckItemVisibility &&
!checkIsItemVisibleForUser({
itemCircleVisibility: item.circleVisibility,
userCircleIds,
itemUserId: item.userId,
currentUserId,
itemDataType: item.data.type,
})
) {
return null;
}

const generalProps = useMemo(
() => ({
Expand Down Expand Up @@ -218,6 +206,20 @@ const FeedItem = forwardRef<FeedItemRef, FeedItemProps>((props, ref) => {
],
);


if (
shouldCheckItemVisibility &&
!checkIsItemVisibleForUser({
itemCircleVisibility: item.circleVisibility,
userCircleIds,
itemUserId: item.userId,
currentUserId,
itemDataType: item.data.type,
})
) {
return null;
}

if (item.data.type === CommonFeedType.Discussion) {
return <DiscussionFeedCard {...generalProps} />;
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/commonFeed/components/FeedLayout/FeedLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ const FeedLayout: ForwardRefRenderFunction<FeedLayoutRef, FeedLayoutProps> = (
fetchedCommonMember;
const userForProfile = useUserForProfile();
const governance = chatItem?.nestedItemData
? fetchedGovernance || outerGovernance
? (fetchedGovernance || outerGovernance)
: outerGovernance || fetchedGovernance;

const [splitPaneRef, setSplitPaneRef] = useState<Element | null>(null);
Expand Down

0 comments on commit 0e0bde0

Please sign in to comment.