Skip to content

[C-5822] Edit track to tan-query #11592

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Conversation

amendelsohn
Copy link
Contributor

@amendelsohn amendelsohn commented Mar 12, 2025

Description

  • updates useUpdateTrack to cover all behavior from editTrack sagas
    • add action and saga watcher to trigger stem uploads flow
    • adds tan-query support for getOrCreateUserBank
  • adopts useUpdateTrack in web and mobile edit pages

Remaining usages of editTrack saga path

  • upload
  • makePublic
    • this one will be easier to migrate

How Has This Been Tested?

Edits working on web and mobile
stems upload working
premium content working

Copy link

changeset-bot bot commented Mar 12, 2025

⚠️ No Changeset found

Latest commit: 8ec1657

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

Comment on lines +43 to +46
} catch (error) {
console.error('Error getting or creating user bank', error)
throw error
}
Copy link
Contributor

Choose a reason for hiding this comment

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

sentry instead of console?
I've also been wondering - should we add a try/catch (or some wrapper) to all our hooks to report to sentry?

existingStems,
updatedStems
}: UpdateStemsArgs) => {
const inProgressStemUploads = getCurrentUploads(
Copy link
Contributor

@DejayJD DejayJD Mar 13, 2025

Choose a reason for hiding this comment

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

is this synchronous? Is not a useSelector type of hook?

edit: oh duh I see you're passing in state as of the call time

Comment on lines +47 to +49
const addedStemsWithFiles = addedStems?.filter(
(stem) => 'file' in stem
) as StemUploadWithFile[]
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this could be done in the filter above

// Create a mutable copy of metadata
let updatedMetadata = {
...metadata
} as Track & TrackMetadataForUpload
Copy link
Contributor

Choose a reason for hiding this comment

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

is this object not just the metadata type? Track being added on here is a lil smelly

Comment on lines +204 to +212
if (optimisticMetadata.musical_key) {
optimisticMetadata.musical_key =
formatMusicalKey(optimisticMetadata.musical_key) ?? null
}

// Format BPM
if (optimisticMetadata.bpm) {
optimisticMetadata.bpm = Number(optimisticMetadata.bpm)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this necessary? Shouldn't this have been handle above on the updatedMetadata?

usdc_purchase: {
price: priceCents,
splits: {
[ownerUserbank?.toString() ?? '']: priceWei
Copy link
Contributor

Choose a reason for hiding this comment

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

noop: I vaguely remember this ?? '' causing issues in indexing or something - wondering if we should just throw here if the userbank doesn't exist 🤔

Copy link
Contributor

@DejayJD DejayJD left a comment

Choose a reason for hiding this comment

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

Some comments but otherwise LGTM

@amendelsohn
Copy link
Contributor Author

leaving this one for @dylanjeffers to shepherd next week. Don't want to introduce regressions and leave without handing off context

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.

2 participants