-
Notifications
You must be signed in to change notification settings - Fork 583
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.
d66e7dd
to
c41d9db
Compare
This PR resolves ONYX-1480
Description
This change brings the "Not interested (in this artwork)" functionality to all artwork recommendation rails on the home screen, and it fixes the artwork rail to filter out disliked artworks so they don't show up again when reopening the app.
To filter out disliked artworks, I use the
isDisliked
field from Metaphysics, which indicates whether a user has disliked the artwork. I double-checked, and queryingisDisliked
is performant and results in only one additional query from MP to Gravity per request 🚀Screenshots
Artwork Rail:
Metaphysics Request Logs
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.