fix(upload): stop the track form wiping description and tags on reinitialize - #14561
Merged
Merged
Conversation
…tialize EditTrackForm runs Formik with `enableReinitialize`, so it resets the whole form whenever `initialValues` deep-changes. UploadTrackForm built those values by spreading `track.metadata` and then hard-overwriting description, tags, stems, isrc and iswc with blanks, plus a fresh `new Date()` every recompute. `formState.tracks` is rewritten with the user's edits on every submit, and EditPage.onContinue calls `setFormState` while still on the edit phase (before the upload confirmation modal resolves). So pressing "Complete Upload" recomputes `initialValues`, Formik resets, and the description and tags the user typed are blanked. Publishing from that point uploads an empty description and no tags, while title/genre/mood/artwork survive because they come from the `...track.metadata` spread — and an emptied genre then falls back to the adapter's `Electronic` default. Prefer values already on `track.metadata` over the `initialMetadata` seed, and drop the `releaseDate` key: it was dead (the adapter reads `release_date`) and minting a new Date on every call guaranteed a reset on every recompute. Reported in #eng: a track published with the description, tags and collaborator all missing right after upload. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the #eng report: a track published with its description, tags and collaborator all missing right after upload.
EditTrackFormruns Formik withenableReinitialize, so it resets the whole form wheneverinitialValuesdeep-changes.UploadTrackFormbuilt those values by spreadingtrack.metadataand then hard-overwritingdescription,tags,stems,isrcandiswcwith blanks — plus a freshnew Date()on every recompute.formState.tracksis rewritten with the user's edits on every submit, andEditPage.onContinuecallssetFormStatewhile still on the edit phase, before the upload confirmation modal resolves. So pressing "Complete Upload" recomputesinitialValues→ Formik resets → the typed description and tags are blanked. Publishing from that point uploads an empty description and no tags, while title/genre/mood/artwork survive because they come from the...track.metadataspread — and an emptied genre then falls back to the adapter'sDEFAULT_GENRE(Electronic).Changes
track.metadataover theinitialMetadataseed, so a reinitialize no longer discards user input.field_visibility.remixesinstead of forcing it back totrue.releaseDatekey — it was dead (the adapter readsrelease_date) and minting anew Date()on every call guaranteed a reset on every recompute.getTrackEditInitialMetadataso it's unit-testable.What this does not cover
The "collaborator vanished" half of the report is a separate, arguably-intended behaviour: the API only returns
pending_collaboratorson the requester's own tracks, andGiantTrackTileselects onlytrack.collaborators(accepted). So a freshly tagged collaborator is invisible on the track page until they accept — even to the owner. Whether the owner should see an "invite pending" chip there is a product call, left alone here.Verification
trackMetadataForUploadToSdk→PublishTrackSchemapipeline with a collaborator present; description, tags and collaborator ids all survive to the on-chain write.track_create.goinsertsdescription/tagsunconditionally and reconciles collaborators separately.UploadTrackForm.test.ts— 2 of the 5 cases fail against the old code and pass with the fix.tsc --noEmitandeslintclean on the touched files.Caveat
I could not reproduce the reporter's exact session end-to-end, so this is a mechanism that matches every observed symptom (including the
Electronicgenre fallback andrelease_date == created_at) rather than a confirmed repro.🤖 Generated with Claude Code