Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,10 @@ def populate_playlist_record_metadata(
# Update the playlist_record when the corresponding field exists
# in playlist_metadata
if key == "playlist_contents":
if not playlist_metadata.get(key):
# Use `is None` rather than a truthiness check so that an explicit
# empty list (the user removing the last track) is applied instead
# of being silently treated as "field omitted".
if playlist_metadata.get(key) is None:
continue
playlist_record.playlist_contents = process_playlist_contents(
playlist_record,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export const EditCollectionForm = (props: EditCollectionFormProps) => {
</Flex>
) : null}
</Tile>
<CollectionTrackFieldArray />
<CollectionTrackFieldArray isUpload={isUpload} />
{isUpload ? <AnchoredSubmitRow /> : <AnchoredSubmitRowEdit />}
{playlist_id ? (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ const makeTrackKey = (track: TrackForUpload | TrackForEdit, index: number) => {
return `${track.metadata.track_id}${suffix}`
}

export const CollectionTrackFieldArray = () => {
type CollectionTrackFieldArrayProps = {
isUpload?: boolean
}

export const CollectionTrackFieldArray = ({
isUpload = false
}: CollectionTrackFieldArrayProps = {}) => {
const [{ value: tracks }] =
useField<(TrackForUpload | TrackForEdit)[]>('tracks')

Expand Down Expand Up @@ -104,7 +110,7 @@ export const CollectionTrackFieldArray = () => {
<CollectionTrackField
index={index}
remove={remove}
disableDelete={tracks.length === 1}
disableDelete={isUpload && tracks.length === 1}
/>
</div>
)}
Expand Down
Loading