Skip to content

Conversation

@raymondjacobson
Copy link
Member

@raymondjacobson raymondjacobson commented Jul 24, 2024

Description

I wish I had a bit of better fix for this, but it requires a much larger refactor that I now understand.

  • Fix bug where you can brick yourself with invalid price / audience state (pay-3187)
  • Fix bad initial state val for preview
  • Fix isUpload check (back to what it was)
  • Fix stop navigation check from failing during upload

This change works by listening to GO_BACK actions from the navigator and re-setting the changes that the inner form made on the formik context.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide repro instructions & any configuration.

  1. Upload track
  2. Visit Price & Audience section
  3. Press Premium
  4. Go back
  5. See that Free For Everyone sticks (previously we would get payment setting set with null)

Same flow, but type a number value and press done and see that it will stick

@changeset-bot
Copy link

changeset-bot bot commented Jul 24, 2024

⚠️ No Changeset found

Latest commit: fbace31

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

const [{ value: remixOf }] = useField<RemixOfField>('remix_of')
const [{ value: isUpload }] = useField<boolean>('is_upload')
const [{ value: entityType }] = useField<string>('entityType')
const isUpload = !initialValues?.track_id
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dylanjeffers I'm not sure why you changed it, but is_upload isn't a field?

Copy link
Contributor

@dylanjeffers dylanjeffers Jul 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be isUpload, and it should be added to the initialValues for collection and track forms. i dont think track_id works because edit collection doesnt have track_id, which would make isUpload true.

Copy link
Member Author

@raymondjacobson raymondjacobson Jul 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see... I'll look more closely. the code as written doesn't work for distinguishing upload vs edit

const handleSubmit = useCallback(() => {
if (!stopNavigation) {
navigation.goBack()
navigation.pop()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be safe and is more semantically correct to what is happening.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this assume we're in a stack navigator? It's probably a fairly safe assumption (especially now)... don't know if it's worth the semantics though

const handleSubmit = useCallback(() => {
if (!stopNavigation) {
navigation.goBack()
navigation.pop()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this assume we're in a stack navigator? It's probably a fairly safe assumption (especially now)... don't know if it's worth the semantics though

// Note that this is a stop gap against a better model which would be to have
// each radio subgroup manage its own state. That requires a larger refactor.
useEffect(() => {
const listener = navigation.addListener('beforeRemove', ({ data }) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious if other sub-forms have this problem? or is it only this one that changes data before submission/save?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah they all have this problem, but this is the one that hasn't covered all the edge cases. since its the most complex by far.

Copy link
Contributor

@dylanjeffers dylanjeffers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice job! one important callout about isUpload to address first, but generally looks great

// Note that this is a stop gap against a better model which would be to have
// each radio subgroup manage its own state. That requires a larger refactor.
useEffect(() => {
const listener = navigation.addListener('beforeRemove', ({ data }) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah they all have this problem, but this is the one that hasn't covered all the edge cases. since its the most complex by far.

stream_conditions: Nullable<AccessConditions>
is_unlisted: boolean
preview_start_seconds: Nullable<Number>
'field_visibility.genre': boolean
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need these? thought we decided to stop using field_visibility on client

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no but not removing in this pr

@raymondjacobson raymondjacobson changed the title [PAY-3187] Fix messed up back button form state for payment stuff [PAY-3187] Fix messed up back button form state for payment settings Jul 24, 2024
@raymondjacobson raymondjacobson merged commit a834436 into main Jul 24, 2024
@raymondjacobson raymondjacobson deleted the rj-pay-3187 branch July 24, 2024 17:56
audius-infra pushed a commit that referenced this pull request Jul 27, 2024
[bea9c85] Fix previously scheduled edit flow (#9278) Dylan Jeffers
[9468507] Improve mobile inner-form revert (#9277) Dylan Jeffers
[15ce2a7] [C-3251] Fix initial state for hidden price-audience field (#9276) Dylan Jeffers
[51a67b4] Fix runtime issue with advanced field (#9275) Dylan Jeffers
[09acfe3] [PAY-3265, PAY-3241] Disallow scheduled playlists in upload/edit; Fix mood placeholder (#9272) Andrew Mendelsohn
[65c886a] [C-4690] Wire up advanced search deep links (#9271) Sebastian Klingler
[deebd52] [C-4874] Update time to 11:59 when scheduling for same day (#9266) Andrew Mendelsohn
[cc407c6] Fix missing refactor bug (#9270) Saliou Diallo
[42e8d11] [PAY-3232] Fix hidden visibility bug when setting price and audience fields (#9268) Saliou Diallo
[523c341] Revert "Update models used in DN reposts endpoints" (#9269) Randy Schott
[89d1e76] [C-4840] Update search screen to auto focus the input (#9263) Kyle Shanks
[9e72dba] [C-4867] Fix collection release date timezone (#9267) Dylan Jeffers
[f5abafe] [C-4866] Fix edit collection form submit (#9262) Dylan Jeffers
[a834436] [PAY-3187] Fix messed up back button form state for payment settings (#9260) Raymond Jacobson
[c3c5b45] [PAY-3196][PAY-3230] Fix miscellaneous editable access issues on mobile (#9258) Saliou Diallo
[823bc63] [C-4793, C-4791] Don't favorite hidden album tracks on purchase (#9254) Andrew Mendelsohn
[6055711] [C-4863] Fix cascading publish on edit collection (#9249) Andrew Mendelsohn
[7500e91] [C-4634] Add popularity sort to users and collections (#9250) Dylan Jeffers
[cd24c79] [C-4843] [C-4846] More advanced search UI fixes (#9252) Sebastian Klingler
[d05de85] [C-4865] Make metadata links visible (#9248) Sebastian Klingler
[8ebbb9d] [C-4847] Reset search filters scroll position (#9242) Sebastian Klingler
[d43760d] PAY-3186 Fixes issue preventing edit screen from opening twice (#9247) Marcus Pasell
[7ffc65c] [C-4834] Animate clear search button for search v2 (#9246) Sebastian Klingler
[24ed1c6] [C-4860] Add waitlist hint for premium album (#9243) Dylan Jeffers
[b336657] Fix type error from SDK update (#9245) Randy Schott
[4fb3d7d] Fix same day scheduled release on web (#9240) Dylan Jeffers
[305a9ef] [PAY-3190] Improve profile page pull to refresh (#9241) Raymond Jacobson
[73a7131] [C-4841] Fix search v2 navigation on mobile (#9233) Sebastian Klingler
[df91fca] [C-4853] Mobile Edit Collection (#9237) Dylan Jeffers
[6473ab1] Update models used in DN reposts endpoints (#9228) Randy Schott
[2c09b40] [C-4792] Disallow Add To Playlist for hidden tracks (#9236) Andrew Mendelsohn
[11f5325] [PAY-3176][PAY-3188][PAY-3193] Include premium tracks in DN playlists for owner (#9234) Saliou Diallo
[f495382] Remove use_sdk_purchase_track and use_sdk_purchase_album feature flags (#9192) Marcus Pasell
[e45bdae] Remove use_sdk_tips feature flag (and fix indexing check) (#9193) Marcus Pasell
[8174034] [C-4832] Fix missing play counts on track tiles (#9230) Kyle Shanks
[20e739c] [QA-1442] Add offline indicator to collection card (#9227) Dylan Jeffers
[fc3648e] [QA-1463] Change order of mobile action buttons (#9229) Reed
[b7ea2fc] [C-4837] Fix links for the searching by electronic subgenre from track page (#9225) Kyle Shanks
[3bd33d4] [QA-1452] Fix edit playlist issues (#9226) Dylan Jeffers
[cedf459] [C-4848] Remove search v2 responsiveness and fix padding on mobile web (#9224) Sebastian Klingler
[e60706c] [C-4842] Fix tag press on mobile for search v2 (#9223) Kyle Shanks
[9e455f2] [C-4829] Fix mobile web drawer overflow (#9220) Dylan Jeffers
[e0af62a] [QA-1458] Fix artwork image loading (#9219) Dylan Jeffers
[4355378] Update dapp-store build artifacts audius-infra
[1aa1dd2] [QA-1455] Fix disappearing playlists in sidebar (#9216) Dylan Jeffers
[9a7ddbf] [C-4643] Feature flag scheduled premium album release (#9215) Dylan Jeffers
[dff2b2d] Bump mobile versions to 107 (#9218) Dylan Jeffers
[42611cb] [PAY-3177][PAY-3185] Fix mobile track publish button (#9213) Saliou Diallo
schottra added a commit that referenced this pull request Jul 29, 2024
* origin/main: (36 commits)
  [PAY-3265, PAY-3241] Disallow scheduled playlists in upload/edit; Fix mood placeholder (#9272)
  [C-4690] Wire up advanced search deep links (#9271)
  [C-4670] Fix track search with deleted premium stems (#9257)
  requery for audio analysis jobs every 15 min (#9265)
  [C-4874] Update time to 11:59 when scheduling for same day (#9266)
  Fix missing refactor bug (#9270)
  [PAY-3232] Fix hidden visibility bug when setting price and audience fields (#9268)
  Revert "Update models used in DN reposts endpoints" (#9269)
  [C-4840] Update search screen to auto focus the input (#9263)
  [C-4867] Fix collection release date timezone (#9267)
  [C-4866] Fix edit collection form submit (#9262)
  [PAY-3187] Fix messed up back button form state for payment settings (#9260)
  Upgrade vector to 0.39.0 (#9261)
  Move to all sha256 ordering (#9239)
  Audius Protocol v0.6.154
  placement hosts analyze legacy audio analyses in addition to storeall node (#9259)
  [PAY-3196][PAY-3230] Fix miscellaneous editable access issues on mobile (#9258)
  mediorum configurable num workers (#9256)
  [C-4793, C-4791] Don't favorite hidden album tracks on purchase (#9254)
  [C-4863] Fix cascading publish on edit collection (#9249)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants