Skip to content

Commit

Permalink
fix: broken edit my collection artwork (#10432)
Browse files Browse the repository at this point in the history
  • Loading branch information
MounirDhahri authored and gkartalis committed Jun 26, 2024
1 parent d1c3c1a commit 3608061
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ interface ArtistAutosuggestProps {
onResultPress: (result: AutosuggestResult) => void
onSkipPress?: (artistDisplayName: string) => void
autoFocus?: boolean
disableFormik?: boolean
}

export const ArtistAutosuggest: React.FC<ArtistAutosuggestProps> = ({
Expand All @@ -44,10 +45,11 @@ export const ArtistAutosuggest: React.FC<ArtistAutosuggestProps> = ({
onResultPress,
onSkipPress,
autoFocus = typeof jest === "undefined",
disableFormik = false,
}) => {
const enableCollectedArtists = useFeatureFlag("AREnableMyCollectionCollectedArtists")

const { formik } = useArtworkForm()
const { formik } = useArtworkForm(disableFormik)
const { artist: artistQuery } = formik.values
const trimmedQuery = artistQuery.trimStart()
const searchProviderValues = useSearchProviderValues(artistQuery)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import { ArtworkFormValues } from "app/Scenes/MyCollection/State/MyCollectionArtworkModel"
import { GlobalStore } from "app/store/GlobalStore"
import { useFeatureFlag } from "app/utils/hooks/useFeatureFlag"
import { FormikProps, useFormikContext } from "formik"
import { useEffect } from "react"

export function useArtworkForm(): { formik: FormikProps<ArtworkFormValues> } {
export function useArtworkForm(disabled?: boolean): { formik: FormikProps<ArtworkFormValues> } {
const formik = useFormikContext<ArtworkFormValues>()
const enableNewSubmissionFlow = useFeatureFlag("AREnableNewSubmissionFlow")

useEffect(() => {
// We don't want to update the form values if the new submission flow is enabled
// because the form values are managed by the new submission flow
if (enableNewSubmissionFlow) {
if (disabled) {
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export const SubmitArtworkSelectArtist = () => {
onResultPress={handleResultPress}
disableCustomArtists
onlyP1Artists
disableFormik
loading={isLoading}
hideCollectedArtists
autoFocus={currentStep === "SelectArtist"}
Expand Down

0 comments on commit 3608061

Please sign in to comment.