fix(cache-prime): personalize embedded users on three more endpoints#14367
Merged
raymondjacobson merged 1 commit intoMay 20, 2026
Merged
Conversation
Audit follow-up to the notifications fix. Three more hooks were priming un-personalized users into the shared tan-query user cache because their SDK request types didn't expose the personalization query param: - useAllRemixContests → events.getRemixContests - useUserRemixContests → users.getContestsByUser - useNewAlbumReleases → playlists.getPlaylistsNewReleases Each handler already calls app.getMyId(c) on the backend; the param just wasn't being sent. AudiusProject/api#839 added the user_id query field to all three routes. This PR: - Regenerates @audius/sdk so each request type accepts userId?: string (additive, no breaking change). - Updates the three hooks to pass userId: Id.parse(currentUserId). After this the cache primes carry the right does_current_user_follow state out of the gate, so explore/contests/new-releases surfaces don't need a profile visit to correct the follow indicators. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: b1b420d The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
🌐 Web preview readyPreview URL: https://audius-web-preview-pr-14367.audius.workers.dev Unique preview for this PR (deployed from this branch). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three more hooks were priming un-personalized users into the shared user cache — same bug class as the notifications fix in #14366. API spec change merged in AudiusProject/api#839; this PR consumes it.
useAllRemixContestsevents.getRemixContestsprimeRelatedDatauseUserRemixContestsusers.getContestsByUserprimeRelatedDatauseNewAlbumReleasesplaylists.getPlaylistsNewReleasesprimeCollectionData→primeUserDataIn every case the backend handler already calls
app.getMyId(c)to feedMyIDinto theParallelquery 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 = 0and the SQL short-circuiteddoes_current_user_followto false for every embedded user. Clients then primed those into a shared cache that other surfaces read.Changes
packages/sdk/src/sdk/api/generated/default/apis/EventsApi.tsuserId?: stringtoGetRemixContestsRequest; map toqueryParameters['user_id'].packages/sdk/src/sdk/api/generated/default/apis/UsersApi.tsuserId?: stringtoGetContestsByUserRequest; map toqueryParameters['user_id']. Path field is stillid(the contest host); queryuserIdis the requester.packages/sdk/src/sdk/api/generated/default/apis/PlaylistsApi.tsuserId?: stringtoGetPlaylistsNewReleasesRequest; map toqueryParameters['user_id'].packages/common/src/api/tan-query/events/useAllRemixContests.tscurrentUserIdviauseCurrentUserId; pass asuserId.packages/common/src/api/tan-query/events/useUserRemixContests.tsuserIdprop for the contest host — that maps to the pathid.currentUserIdis separately threaded as the query.packages/common/src/api/tan-query/collection/useNewAlbumReleases.tscurrentUserId; pass asuserId..changeset/personalization-three-endpoints.md@audius/sdkbump for the new optional fields.Note on the SDK files in this diff
I edited the generated
*.tsfiles by hand here becausenpm installin my environment was blocked by a date-pinned registry constraint, which brokenode_modulesand stopped bothgen.jsand the rollup build from running. The edits are deterministic — they replicate the exact pattern openapi-generator already produces for analogous endpoints (e.g.GetTrendingPlaylistsRequestin the samePlaylistsApi.ts). A freshnpm run genon a clean checkout should produce the same diff. Worth a quick visual confirmation during review.Test plan
?user_id=<hashed-current-user-id>anddoes_current_user_follow: truefor users actually followed inrelated.users/ collection owners.🤖 Generated with Claude Code