Skip to content
Draft
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
65 changes: 65 additions & 0 deletions 0001-Fix-private-playlist-creation-bug.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
From 4593de6756e842d40290058348f16f01f6f54cf3 Mon Sep 17 00:00:00 2001
From: Cursor Agent <cursoragent@cursor.com>
Date: Mon, 9 Mar 2026 22:59:21 +0000
Subject: [PATCH] Fix private playlist creation bug

- Changed collection metadata schema default for is_private from true to false
- Removed hardcoded is_private = true in playlist/album optimistic saves
- Playlists and albums now respect the is_private value from form fields

This fixes the issue where users couldn't create playlists successfully because:
1. Schema defaulted to is_private: true
2. Optimistic save hardcoded is_private: true
3. This caused all new playlists to be created as private
4. Private playlists have different visibility/persistence behavior
5. Users experienced playlists that appeared to be creating but never completed
6. On refresh, playlists would disappear (404)

Now playlists default to public (is_private: false) and respect user's
visibility choice through the UI's VisibilityField component.
---
packages/common/src/schemas/metadata.ts | 2 +-
.../web/src/common/store/cache/collections/createAlbumSaga.ts | 1 -
.../src/common/store/cache/collections/createPlaylistSaga.ts | 1 -
3 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/packages/common/src/schemas/metadata.ts b/packages/common/src/schemas/metadata.ts
index ef55246934..ab57be5324 100644
--- a/packages/common/src/schemas/metadata.ts
+++ b/packages/common/src/schemas/metadata.ts
@@ -100,7 +100,7 @@ export const newTrackMetadata = (
const collectionMetadataSchema = {
is_album: false,
is_current: true,
- is_private: true,
+ is_private: false,
tags: null,
genre: null,
mood: null,
diff --git a/packages/web/src/common/store/cache/collections/createAlbumSaga.ts b/packages/web/src/common/store/cache/collections/createAlbumSaga.ts
index 386b2cc0e3..fc11ca4385 100644
--- a/packages/web/src/common/store/cache/collections/createAlbumSaga.ts
+++ b/packages/web/src/common/store/cache/collections/createAlbumSaga.ts
@@ -104,7 +104,6 @@ function* optimisticallySaveAlbum(
const initTrackOwner = yield* queryUser(initTrack?.owner_id)

album.playlist_owner_id = user_id
- album.is_private = true
album.playlist_contents = {
track_ids: initTrack
? [
diff --git a/packages/web/src/common/store/cache/collections/createPlaylistSaga.ts b/packages/web/src/common/store/cache/collections/createPlaylistSaga.ts
index 808ff4c189..3b67a2c379 100644
--- a/packages/web/src/common/store/cache/collections/createPlaylistSaga.ts
+++ b/packages/web/src/common/store/cache/collections/createPlaylistSaga.ts
@@ -118,7 +118,6 @@ function* optimisticallySavePlaylist(
const initTrackOwner = yield* queryUser(initTrack?.owner_id)

playlist.playlist_owner_id = user_id
- playlist.is_private = true
playlist.playlist_contents = {
track_ids: initTrack
? [
--
2.43.0

70 changes: 70 additions & 0 deletions PLAYLIST_BUG_FIX.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Private Playlist Creation Bug Fix

## Summary

Fixed the bug where users were unable to create playlists on Audius. The playlists would appear to be creating but never complete, just sitting there trying to load album art, and would disappear with a 404 error on refresh.

## Root Cause

The bug was caused by an incorrect default value in the collection metadata schema:

1. **Schema Default Issue**: The `collectionMetadataSchema` had `is_private: true` as the default value, causing all new playlists to be created as private/hidden by default.

2. **Hardcoded Values**: Both `createPlaylistSaga.ts` and `createAlbumSaga.ts` had hardcoded `is_private = true` in their optimistic save functions, overriding any user preference.

3. **Mismatch Between Intent and Behavior**: When users created playlists through the UI without explicitly setting visibility, the playlists were unintentionally created as private, which has different visibility and persistence behavior than public playlists.

## Changes Made

### 1. Fixed Schema Default
**File**: `audius-protocol/packages/common/src/schemas/metadata.ts`
- Changed `is_private: true` to `is_private: false` (line 103)

### 2. Removed Hardcoded Playlist Privacy
**File**: `audius-protocol/packages/web/src/common/store/cache/collections/createPlaylistSaga.ts`
- Removed hardcoded `playlist.is_private = true` from `optimisticallySavePlaylist` function (previously line 121)
- Now respects the `is_private` value from `formFields`

### 3. Removed Hardcoded Album Privacy
**File**: `audius-protocol/packages/web/src/common/store/cache/collections/createAlbumSaga.ts`
- Removed hardcoded `album.is_private = true` from `optimisticallySaveAlbum` function (previously line 107)
- Now respects the `is_private` value from `formFields`

## Why This Fixes the Bug

1. **Correct Default Behavior**: Playlists now default to public (`is_private: false`), which matches the expected behavior for most playlist creation flows.

2. **Respects User Choice**: Users can still create private playlists through the UI's `VisibilityField` component, which allows them to choose between:
- Public (default)
- Hidden (private)
- Scheduled Release (for albums/tracks)

3. **Consistent State**: The optimistic UI state now matches the actual state sent to the backend API, preventing the mismatch that caused playlists to appear to be creating but never completing.

## How to Apply This Fix

The fix has been committed to the `fix/private-playlist-creation-bug` branch in the audius-protocol repository.

A patch file is also available at: `/workspace/0001-Fix-private-playlist-creation-bug.patch`

To apply the patch to the audius-protocol repository:

```bash
cd /path/to/audius-protocol
git apply /workspace/0001-Fix-private-playlist-creation-bug.patch
```

## Testing Recommendations

1. **Create a playlist from the library page** - Should create successfully and appear immediately
2. **Create a playlist from a track** - Should create with the track included
3. **Create a hidden playlist** - Use the visibility field to set it as hidden, should work correctly
4. **Create an album** - Should create with public visibility by default
5. **Refresh after creating** - Playlist should persist and not 404

## Related Files

- `packages/web/src/components/edit/fields/visibility/VisibilityField.tsx` - UI component for setting playlist/album visibility
- `packages/web/src/pages/upload-page/forms/UploadCollectionForm.tsx` - Upload form that explicitly sets `is_private: false`
- `packages/common/src/adapters/collection.ts` - Adapter that converts collection metadata for SDK calls (line 182: `isPrivate: input.is_private ?? false`)
- `packages/discovery-provider/src/queries/get_playlists.py` - Backend query that filters private playlists for non-owners