-
Notifications
You must be signed in to change notification settings - Fork 9
fix: LEFT-join artists in catalog-songs read (materialized tracks were hidden) #681
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
Changes from all commits
dadaa7a
c2bb97b
6339530
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,9 +55,9 @@ export async function selectCatalogSongsWithArtists( | |
| album, | ||
| notes, | ||
| updated_at, | ||
| song_artists!inner ( | ||
| song_artists ( | ||
| artist, | ||
| accounts!inner ( | ||
| accounts ( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: With artists:
song_artists?.flatMap((sa: SongArtistWithAccount) =>
sa.accounts ? [sa.accounts] : [],
) || [],Prompt for AI agents |
||
| id, | ||
| name, | ||
| timestamp | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: recoupable/api
Length of output: 50370
🏁 Script executed:
cat -n lib/supabase/catalog_songs/selectCatalogSongsWithArtists.ts | head -120Repository: recoupable/api
Length of output: 3851
🏁 Script executed:
Repository: recoupable/api
Length of output: 40
🏁 Script executed:
fd -type f name "selectSongsWithArtists.ts" lib/Repository: recoupable/api
Length of output: 229
🏁 Script executed:
Repository: recoupable/api
Length of output: 956
🏁 Script executed:
Repository: recoupable/api
Length of output: 1466
🏁 Script executed:
Repository: recoupable/api
Length of output: 688
Filter null accounts from LEFT-joined artist records to maintain type contract.
The query uses LEFT joins for
song_artistsandaccounts(no!inner), which can produce null values. However, the mapping at line 109 does not filter them:song_artists?.map((sa) => sa.accounts) || []will pass nulls into theartistsarray, contradicting the non-null type signatureartists: Tables<"accounts">[].Compare with
selectSongsWithArtists.ts(line 48), which uses INNER joins and defensively includes.filter(Boolean). Apply the same filtering pattern here:🤖 Prompt for AI Agents