mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-21 23:05:46 +00:00
fix(seekbar): blank canvas after update from legacy build (#432)
After PR #316 split the 'waveform' seekbar style into 'truewave' / 'pseudowave', users who carried any other unrecognised persisted value (legacy variants, undefined, tampered strings) ended up with a blank seekbar — the rehydrate migration matched only the literal 'waveform' string, and the drawSeekbar dispatcher had no default branch, so an unknown style drew nothing. Two-layer fix: * authStore migration now treats *any* value not in the current SeekbarStyle union as legacy and resets it to 'truewave'. * drawSeekbar gains a default case that falls back to the truewave renderer, so even if a future style mismatch slips through the store-level guard the user still sees a usable seekbar. Visible to affected users on next app start (rehydrate runs once per session). Clicking a style in Settings has always worked around the issue; this fix removes that workaround.
This commit is contained in:
committed by
GitHub
parent
0785385c7f
commit
fca8fc5318
+12
-6
@@ -800,12 +800,18 @@ export const useAuthStore = create<AuthState>()(
|
||||
} catch { /* ignore */ }
|
||||
}
|
||||
|
||||
// One-time: 'waveform' style was renamed to 'truewave' (with 'pseudowave'
|
||||
// added as the deterministic legacy variant). Existing persisted value
|
||||
// 'waveform' should land on the new bins-based default.
|
||||
const seekbarStyleMigrated = (state.seekbarStyle as string) === 'waveform'
|
||||
? { seekbarStyle: 'truewave' as SeekbarStyle }
|
||||
: {};
|
||||
// 'waveform' style was renamed to 'truewave' (with 'pseudowave' added
|
||||
// as the deterministic legacy variant). Any persisted value that is
|
||||
// not a valid SeekbarStyle (legacy 'waveform', undefined, tampered
|
||||
// strings) lands on the new bins-based default — otherwise the
|
||||
// dispatcher's switch finds no match and the seekbar renders blank.
|
||||
const VALID_SEEKBAR_STYLES = new Set<string>([
|
||||
'truewave', 'pseudowave', 'linedot', 'bar', 'thick',
|
||||
'segmented', 'neon', 'pulsewave', 'particletrail', 'liquidfill', 'retrotape',
|
||||
]);
|
||||
const seekbarStyleMigrated = VALID_SEEKBAR_STYLES.has(state.seekbarStyle as string)
|
||||
? {}
|
||||
: { seekbarStyle: 'truewave' as SeekbarStyle };
|
||||
|
||||
const st = state as {
|
||||
loudnessTargetLufs?: unknown;
|
||||
|
||||
Reference in New Issue
Block a user