Share numeric source id in deep links instead of uuid - #142
Conversation
Share URLs from the mobile app emitted ?source=<uuid>, but relisten.net resolves sources by numeric id (Number(source)), so mobile-shared links silently fell back to the show's first source instead of the shared tape. Persist the numeric source id (returned by the API, previously dropped by the Realm model) as Source.sourceId, and emit it from all four share sites, falling back to uuid only when the id isn't populated yet. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e6caac15b8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| primaryKey: 'uuid', | ||
| properties: { | ||
| uuid: 'string', | ||
| sourceId: 'int?', |
There was a problem hiding this comment.
Backfill sourceId for cached sources
For existing users who already have Source rows cached, this optional column is created as null and the next online refresh does not necessarily populate it: Repository.upsertWithinWrite skips propertiesFromApi unless the API updated_at is newer or shouldUpdateFromApi returns true. For unchanged shows, all new share call sites will therefore keep falling back to the UUID until the remote source changes or the database is rebuilt, so the main fix still fails for cached sources; add a migration/backfill or a Source.shouldUpdateFromApi check when sourceId is missing.
Useful? React with 👍 / 👎.
Problem
Share buttons in the mobile app generated deep links like
https://relisten.net/phish/2004/06/26/boogie-on-reggae-woman-21978?source=32ee904b-2edb-…— a source UUID. But relisten.net resolves thesourcequery param by numeric id (Number(source)inuseSourceData).Number("<uuid>")isNaN, so shared links silently fell back to the show's first source rather than the tape that was actually shared.Fix
The API already returns a numeric source
id(marked "only used for deep-linking"), but the RealmSourcemodel was dropping it. This change:Source.sourceId(added to the interface, class field, schema asint?, andpropertiesFromApi), and bumps the RealmschemaVersion12 → 13 (additive optional property — Realm migrates automatically).sourceId, falling back touuidonly if the id isn't populated yet (so we never emit?source=undefined):player_screen.tsxsource_track_actions_menu.tsxsource/[sourceUuid]/index.tsx(×2)New links look like
…?source=2173898, which the web resolves correctly.Notes
sourceIduntil re-fetched from the API; until then the?? uuidfallback emits a uuid. It self-heals as soon as the show/source loads online.🤖 Generated with Claude Code