From 78400f1fca01c7377d8673c3749f21874e038201 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 15 Jul 2026 01:24:54 +0000 Subject: [PATCH 1/2] polish: debounce search + low-severity roundup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #16: feed the fuzzy search a useDeferredValue(query) so fast typing over a large library doesn't drop input frames (React can skip intermediate list renders). #19 roundup: - formatTime now shows hours (3661 → "1:01:01") instead of "61:01". - Replace the biased `[...a].sort(() => Math.random() - 0.5)` shuffle (Library + Playlist "Shuffle") with a shared uniform Fisher–Yates `shuffle()` helper. - Revoke the last object URL when PlayerProvider unmounts (the per-track effect only revoked the previous one on the next load). - MediaMetadata artwork: use sizes 'any' + type 'image/jpeg' (ytimg thumbnails are JPEG) instead of a false hardcoded 512x512/png. - Attach .catch to the fire-and-forget mutations (toggleStar in TrackRow/Player/ sheet, bumpPlayCount, seed/removeSamples) so a rejected transaction doesn't become an unhandled rejection. Verified: formatTime + shuffle unit-tested (hours, edge cases, permutation); search still filters and shows the no-match hint in-browser; build clean. Fixes #16. Fixes #19. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01FkDKh1Uo1a4D7n5wCKdcKF --- src/components/AddToPlaylistSheet.jsx | 2 +- src/components/LibraryView.jsx | 3 ++- src/components/Player.jsx | 2 +- src/components/PlaylistsView.jsx | 3 ++- src/components/SearchView.jsx | 8 ++++++-- src/components/TrackRow.jsx | 2 +- src/lib/format.js | 10 ++++++---- src/lib/shuffle.js | 11 +++++++++++ src/main.jsx | 4 ++-- src/state/PlayerProvider.jsx | 10 ++++++++-- 10 files changed, 40 insertions(+), 15 deletions(-) create mode 100644 src/lib/shuffle.js diff --git a/src/components/AddToPlaylistSheet.jsx b/src/components/AddToPlaylistSheet.jsx index 97867df..4d50cf2 100644 --- a/src/components/AddToPlaylistSheet.jsx +++ b/src/components/AddToPlaylistSheet.jsx @@ -47,7 +47,7 @@ export default function AddToPlaylistSheet() { - diff --git a/src/components/LibraryView.jsx b/src/components/LibraryView.jsx index 6aa47d9..37f6df4 100644 --- a/src/components/LibraryView.jsx +++ b/src/components/LibraryView.jsx @@ -1,6 +1,7 @@ import { useState } from 'react' import { useTracks } from '../state/useLibrary' import { usePlayer } from '../state/PlayerProvider' +import { shuffle } from '../lib/shuffle' import TrackRow from './TrackRow' import ImportButton from './ImportButton' @@ -35,7 +36,7 @@ export default function LibraryView() { - diff --git a/src/components/Player.jsx b/src/components/Player.jsx index c3adc54..6bf58e5 100644 --- a/src/components/Player.jsx +++ b/src/components/Player.jsx @@ -89,7 +89,7 @@ function NowPlaying({ p, onClose }) {