Skip to content
This repository was archived by the owner on May 25, 2026. It is now read-only.

feat(picker): wire shuffle action to /api/shuffle - #79

Merged
ivorycrayon merged 3 commits into
mainfrom
feature/wire-picker-shuffle-and-retry-source
May 25, 2026
Merged

feat(picker): wire shuffle action to /api/shuffle#79
ivorycrayon merged 3 commits into
mainfrom
feature/wire-picker-shuffle-and-retry-source

Conversation

@sudoesnothing

@sudoesnothing sudoesnothing commented May 25, 2026

Copy link
Copy Markdown
Contributor

What

Replaces the picker's local shuffle stub with a real POST /api/shuffle
round-trip (backend shipped across #47, #54, #56, #58).

  • handleShuffle now POSTs {playlistId}, validates the response shape,
    and maps 8 error codes to ErrorKind via mapShuffleError.
  • A 1000ms phase-flip (cancel-on-settle) prevents "Saving new playlist…"
    from flashing on fast round-trips before "Done." lands.
  • Error view gains a four-way CTA: session expiry goes to login; unshuffleable
    playlists get "Pick another" (restores picker, no refetch); shuffle failures
    with a source set get "Try again" (re-POSTs the same playlist id); load-path
    errors keep the existing reloadKey bump.
  • LoadState's error variant now carries optional source / playlists to
    support the above without a refetch on either recovery path.

Why

The backend has been live against real Spotify for a week; wiring the picker
now is the natural close of the round-trip.

The source-aware retry is the meaningful design call here. The existing
reload-picker behavior makes a user re-find their playlist in a long list
after every rate-limit or transient error. Carrying source through the
error round-trip lets "Try again" re-POST the same playlist directly.
playlists travels with the error for the same reason: "Pick another" can
restore the picker without paying a refetch.

Test plan

  • Real Spotify auth: click Shuffle on Liked Songs and confirm a new
    shuffled playlist with the expected name suffix appears in the library.
  • Click Shuffle on a normal playlist and confirm the resulting playlist
    carries the correct Shuffled YYYY-MM-DD suffix in the Spotify app.
  • Trigger a non-trivial error path against a live network (kill network
    mid-shuffle for an upstream error, or expire the session cookie) and
    confirm the correct CTA renders.

@ivorycrayon
ivorycrayon merged commit a23f0de into main May 25, 2026
1 check passed
@ivorycrayon
ivorycrayon deleted the feature/wire-picker-shuffle-and-retry-source branch May 25, 2026 07:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants