Skip to content

Share numeric source id in deep links instead of uuid - #142

Open
switz wants to merge 1 commit into
mainfrom
share-numeric-source-id
Open

Share numeric source id in deep links instead of uuid#142
switz wants to merge 1 commit into
mainfrom
share-numeric-source-id

Conversation

@switz

@switz switz commented Jul 9, 2026

Copy link
Copy Markdown
Member

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 the source query param by numeric id (Number(source) in useSourceData). Number("<uuid>") is NaN, 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 Realm Source model was dropping it. This change:

  • Persists it as Source.sourceId (added to the interface, class field, schema as int?, and propertiesFromApi), and bumps the Realm schemaVersion 12 → 13 (additive optional property — Realm migrates automatically).
  • Updates all four share sites to emit sourceId, falling back to uuid only if the id isn't populated yet (so we never emit ?source=undefined):
    • player_screen.tsx
    • source_track_actions_menu.tsx
    • source/[sourceUuid]/index.tsx (×2)

New links look like …?source=2173898, which the web resolves correctly.

Notes

  • Transition gap: cached sources won't have sourceId until re-fetched from the API; until then the ?? uuid fallback emits a uuid. It self-heals as soon as the show/source loads online.
  • Pre-existing uuid links (already posted publicly) still won't resolve on web, since relisten-web only matches on numeric id. A follow-up on the web side could also match on uuid to rescue those — not included here since id is the preferred format.

🤖 Generated with Claude Code

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>
@switz
switz requested a review from alecgorge July 9, 2026 17:20

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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?',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant