-
Notifications
You must be signed in to change notification settings - Fork 577
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
feat: Infer artist series when creating alert form artwork screen #9631
feat: Infer artist series when creating alert form artwork screen #9631
Conversation
@@ -30,6 +31,13 @@ export const CreateArtworkAlertModal: React.FC<CreateArtworkAlertModalProps> = ( | |||
const data = useFragment<CreateArtworkAlertModalProps["artwork"]>( | |||
graphql` | |||
fragment CreateArtworkAlertModal_artwork on Artwork { | |||
artistSeriesConnection(first: 5) { |
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.
Using 5 as the maximum number of artist series used when creating an alert would cover 99.98% of the cases.(context: artsy/force#13244 (comment))
if (!artworkAlert) { | ||
return null | ||
} |
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.
Refactoring this component to be able to remove the forbidden non-null assertions.
export const extractPillFromArtistSeriesIDs = (values: string[]): SavedSearchPill[] => { | ||
return values.map((value) => { | ||
return { | ||
label: toTitleCase(value.replaceAll("-", " ")), |
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 isn't ideal, but it should be good enough for now. We have already moved the pill/label generation to Metaphysics and will remove this code soon in favor of using the backend-generated labels.
Because of this, I have decided not to write any additional code to make the name of the artist series accessible here and use this quick workaround until removing this code.
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.
Agree with this, let's push to work on the migration asap.
A small adjustment I would suggest here is to rename values
to slugs
and also value
to slug
. It would be nice to rename the method as well since you are querying for slugs instead of ids but I will leave that to you to decide since we do the same thing in other areas
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.
also, do you mind if you add a test for this as we do for other existing extractors
dcc3003
to
4dd602e
Compare
artwork: CreateArtworkAlertModal_artwork$data | BrowseSimilarWorks_artwork$data | ||
) => { | ||
const enableArtistSeriesFilter = useFeatureFlag("AREnableArtistSeriesFilter") |
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.
Still an open discussion whether to use a second feature flag here (Slack Thread)
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.
LGTM! small comments none are blocking
@@ -11,6 +12,10 @@ jest.mock("app/Components/Artist/ArtistArtworks/CreateSavedSearchModal", () => ( | |||
CreateSavedSearchModal: () => "CreateSavedSearchModal", | |||
})) | |||
|
|||
jest.mock("app/utils/hooks/useFeatureFlag", () => ({ | |||
useFeatureFlag: () => true, |
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.
nitpick: I would avoid this in favour of using our own __globalStoreTestUtils__?.injectFeatureFlags
helper.
export const extractPillFromArtistSeriesIDs = (values: string[]): SavedSearchPill[] => { | ||
return values.map((value) => { | ||
return { | ||
label: toTitleCase(value.replaceAll("-", " ")), |
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.
Agree with this, let's push to work on the migration asap.
A small adjustment I would suggest here is to rename values
to slugs
and also value
to slug
. It would be nice to rename the method as well since you are querying for slugs instead of ids but I will leave that to you to decide since we do the same thing in other areas
export const extractPillFromArtistSeriesIDs = (values: string[]): SavedSearchPill[] => { | ||
return values.map((value) => { | ||
return { | ||
label: toTitleCase(value.replaceAll("-", " ")), |
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.
also, do you mind if you add a test for this as we do for other existing extractors
Closing this PR because we only want to suggest artist series (Slack Thread) |
This PR resolves ONYX-566
Description
This change adds artist series as an initial criterion when creating the alert from the artwork screen.
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.