-
Notifications
You must be signed in to change notification settings - Fork 581
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
fix: Filter out disliked artworks on artworks rail #11366
base: main
Are you sure you want to change the base?
fix: Filter out disliked artworks on artworks rail #11366
Conversation
@@ -155,21 +141,6 @@ export const ContextMenuArtwork: React.FC<ContextMenuArtworkProps> = ({ | |||
}, | |||
] | |||
|
|||
if (!enableSupressArtwork) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for sneaking this change into the PR... The "Save" or "Watch Lot" action should be removed from the context menu because they are already present on all artwork rail and grid cards.
Slack thread with request for deleting the item: https://artsy.slack.com/archives/C05EQL4R5N0/p1715340751240539
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM. I would also consider doing this filtering from the backend and potentially supporting it within the filterArtworksConnection
. I know this might mean we need changes to MP and Gravity but it might be worth it.
If you already considered that, don't mind my comment. The code looks good to me
let artworks = extractNodes(section.artworksConnection) | ||
|
||
if (isDislikeArtworksEnabled(section.contextModule)) { | ||
artworks = artworks.filter((artwork) => !artwork.isDisliked) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filtering disliked artworks from the rail might break pagination if the last artwork is a disliked one. Because we would query the 2nd page using the last node (which will be the last non disliked artwork).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that's fine, here because the worst that can happen is we return a list that's shorter than 10. and this only breaks if one dislikes all last 10 artworks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! We need to make sure pagination is still working when filtering out the artworks after fetching the data.
I assumed this may lead to smaller pages but would not break pagination 🤞 However, I haven't tested it yet, especially considering the case where the last artwork on a page was disliked. I'll do some more testing before merging.
This PR resolves ONYX-1480
Description
It's possible to dislike/hide artworks on the home screen's "New Works for You" rail, but currently, the artworks show up again after reopening the app.
In order to always filter out disliked artworks on the "New Works for You" rail, we need to filter artworks using the
isDisliked
field, which hasn't been implemented for the rail. This PR adds the filter.In addition to that this PR removes the "Save" item from the context menu from all artwork cards and not only for the "New Works for You" rail.
PR Checklist
To the reviewers 👀
Changelog updates
Changelog updates
Cross-platform user-facing changes
iOS user-facing changes
Android user-facing changes
Dev changes
Need help with something? Have a look at our docs, or get in touch with us.