Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GAL-5166] fix to remove empty feed items #2378

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions apps/web/src/components/Feed/FeedEventItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ export default function FeedEventItemWithBoundary({
... on UserFollowedUsersFeedEventData {
__typename
}
... on GalleryUpdatedFeedEventData {
subEventDatas {
__typename
}
}
}
...FeedEventSocializeSectionFragment
...FeedEventItemFragment
Expand All @@ -110,6 +115,18 @@ export default function FeedEventItemWithBoundary({
onPotentialLayoutShift(index);
}, [index, onPotentialLayoutShift]);

// check that subEvents is non-empty
if (event.eventData?.__typename !== 'UserFollowedUsersFeedEventData') {
// ignore GalleryInfoUpdatedFeedEventData events because we have no component to handle that right now
const subEvents = event?.eventData?.subEventDatas
?.slice(0, 4)
.filter((event) => event.__typename !== 'GalleryInfoUpdatedFeedEventData');

if (!subEvents?.length) {
return null;
}
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kind of a hacky fix but basically was trying to ignore the eventDataTypeGalleryInfoUpdatedFeedEventData because we don't have a component for it from this file so it would always be an empty item for this event type. I wanted to know if you had a better idea of how I could fix this @Robinnnnn! thanks

Screenshot 2024-03-23 at 15 43 19

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry but why can't we just introduce a new component in the screenshot you provided?

return (
<ReportingErrorBoundary fallback={<></>}>
<FeedEventItemContainer gap={16}>
Expand Down
Loading