Commit be0537f
fix(cache-prime): personalize embedded users on three more endpoints (#14367)
## Summary
Three more hooks were priming un-personalized users into the shared user
cache — same bug class as the notifications fix in
[#14366](#14366). API spec
change merged in
[AudiusProject/api#839](AudiusProject/api#839);
this PR consumes it.
| Hook | SDK call | Prime |
| --- | --- | --- |
| `useAllRemixContests` | `events.getRemixContests` | `primeRelatedData`
|
| `useUserRemixContests` | `users.getContestsByUser` |
`primeRelatedData` |
| `useNewAlbumReleases` | `playlists.getPlaylistsNewReleases` |
`primeCollectionData` → `primeUserData` |
In every case the backend handler already calls `app.getMyId(c)` to feed
`MyID` into the `Parallel` query that hydrates embedded users — the
query param just wasn't being sent because the SDK request type didn't
expose it. With no value, `MyID = 0` and the SQL
[short-circuited](https://github.com/AudiusProject/api/blob/main/api/dbv1/get_users.sql.go#L129-L136)
`does_current_user_follow` to false for every embedded user. Clients
then primed those into a shared cache that other surfaces read.
## Changes
| File | Change |
| --- | --- |
| `packages/sdk/src/sdk/api/generated/default/apis/EventsApi.ts` | Add
`userId?: string` to `GetRemixContestsRequest`; map to
`queryParameters['user_id']`. |
| `packages/sdk/src/sdk/api/generated/default/apis/UsersApi.ts` | Add
`userId?: string` to `GetContestsByUserRequest`; map to
`queryParameters['user_id']`. Path field is still `id` (the contest
host); query `userId` is the requester. |
| `packages/sdk/src/sdk/api/generated/default/apis/PlaylistsApi.ts` |
Add `userId?: string` to `GetPlaylistsNewReleasesRequest`; map to
`queryParameters['user_id']`. |
| `packages/common/src/api/tan-query/events/useAllRemixContests.ts` |
Pull `currentUserId` via `useCurrentUserId`; pass as `userId`. |
| `packages/common/src/api/tan-query/events/useUserRemixContests.ts` |
Same. Note this hook already took a `userId` prop for the contest host —
that maps to the path `id`. `currentUserId` is separately threaded as
the query. |
| `packages/common/src/api/tan-query/collection/useNewAlbumReleases.ts`
| Pull `currentUserId`; pass as `userId`. |
| `.changeset/personalization-three-endpoints.md` | Minor `@audius/sdk`
bump for the new optional fields. |
## Note on the SDK files in this diff
I edited the generated `*.ts` files by hand here because `npm install`
in my environment was blocked by a date-pinned registry constraint,
which broke `node_modules` and stopped both `gen.js` and the rollup
build from running. The edits are deterministic — they replicate the
exact pattern openapi-generator already produces for analogous endpoints
(e.g. `GetTrendingPlaylistsRequest` in the same `PlaylistsApi.ts`). A
fresh `npm run gen` on a clean checkout should produce the same diff.
Worth a quick visual confirmation during review.
## Test plan
- [ ] CI green (typecheck/lint/tests).
- [ ] On a fresh app load with a signed-in account: explore → contests
carousel, an artist's contests tab, and browse → new albums all show
correct Following state for surfaced artists without first having to
navigate to each profile.
- [ ] Network inspector on each of the three endpoints carries
`?user_id=<hashed-current-user-id>` and `does_current_user_follow: true`
for users actually followed in `related.users` / collection owners.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>1 parent 6bd5c27 commit be0537f
7 files changed
Lines changed: 51 additions & 3 deletions
File tree
- .changeset
- packages
- common/src/api/tan-query
- collection
- events
- sdk/src/sdk/api/generated/default/apis
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
38 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
39 | 46 | | |
40 | 47 | | |
41 | 48 | | |
| |||
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
| 66 | + | |
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
| |||
74 | 77 | | |
75 | 78 | | |
76 | 79 | | |
77 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
78 | 85 | | |
79 | 86 | | |
80 | 87 | | |
| |||
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
| 71 | + | |
70 | 72 | | |
71 | 73 | | |
72 | 74 | | |
| |||
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
85 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
86 | 92 | | |
87 | 93 | | |
88 | 94 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
| |||
550 | 551 | | |
551 | 552 | | |
552 | 553 | | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
553 | 558 | | |
554 | 559 | | |
555 | 560 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
99 | 100 | | |
100 | 101 | | |
101 | 102 | | |
| |||
533 | 534 | | |
534 | 535 | | |
535 | 536 | | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
536 | 541 | | |
537 | 542 | | |
538 | 543 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
322 | 322 | | |
323 | 323 | | |
324 | 324 | | |
| 325 | + | |
325 | 326 | | |
326 | 327 | | |
327 | 328 | | |
| |||
1739 | 1740 | | |
1740 | 1741 | | |
1741 | 1742 | | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
1742 | 1747 | | |
1743 | 1748 | | |
1744 | 1749 | | |
| |||
0 commit comments