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

fix: Filter out disliked artworks on artworks rail #11366

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

olerichter00
Copy link
Contributor

@olerichter00 olerichter00 commented Jan 9, 2025

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 querying isDisliked is performant and results in only one additional query from MP to Gravity per request 🚀

Screenshots

Artwork Rail:

Simulator Screenshot - iPhone SE (3rd generation) - 2025-01-24 at 12 31 20 Simulator Screenshot - iPhone SE (3rd generation) - 2025-01-24 at 12 32 09

Metaphysics Request Logs

Bildschirmfoto 2025-01-24 um 12 25 12

PR Checklist

  • I have tested my changes on iOS and Android.
  • I hid my changes behind a feature flag, or they don't need one.
  • I have included screenshots or videos, or I have not changed the UI.
  • I have added tests, or my changes don't require any.
  • I added an app state migration, or my changes do not require one.
  • I have documented any follow-up work that this PR will require, or it does not require any.
  • I have added a changelog entry below, or my changes do not require one.

To the reviewers 👀

  • I would like at least one of the reviewers to run this PR on the simulator or device.
Changelog updates

Changelog updates

Cross-platform user-facing changes

  • Fix the "Not Interested" feature (long-press context menu) on the home screen's artwork recommendation rails - ole

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.

@@ -155,21 +141,6 @@ export const ContextMenuArtwork: React.FC<ContextMenuArtworkProps> = ({
},
]

if (!enableSupressArtwork) {
Copy link
Contributor Author

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

simulator_screenshot_4190F5AF-F883-4CD8-9A6A-E1C083F5FADD

Copy link
Member

@MounirDhahri MounirDhahri left a 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)
Copy link
Member

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).

Copy link
Member

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

Copy link
Contributor Author

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.

@olerichter00 olerichter00 marked this pull request as draft January 15, 2025 15:28
@olerichter00 olerichter00 force-pushed the olerichter00/ONYX-1480/filter-out-disliked-artworks-on-artworks-rail branch from d66e7dd to c41d9db Compare January 24, 2025 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants