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
@@ -785,6 +785,10 @@ export function drawSeekbar(
|
|||||||
case 'particletrail': drawParticleTrail(canvas, progress, buffered, anim); break;
|
case 'particletrail': drawParticleTrail(canvas, progress, buffered, anim); break;
|
||||||
case 'liquidfill': drawLiquidFill(canvas, progress, buffered, anim); break;
|
case 'liquidfill': drawLiquidFill(canvas, progress, buffered, anim); break;
|
||||||
case 'retrotape': drawRetroTape(canvas, progress, buffered, anim); break;
|
case 'retrotape': drawRetroTape(canvas, progress, buffered, anim); break;
|
||||||
|
// Safety net: if a legacy or tampered persisted style sneaks past the
|
||||||
|
// authStore migration, fall back to the truewave renderer instead of
|
||||||
|
// leaving a blank canvas.
|
||||||
|
default: drawWaveform(canvas, heights, progress, buffered); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-6
@@ -800,12 +800,18 @@ export const useAuthStore = create<AuthState>()(
|
|||||||
} catch { /* ignore */ }
|
} catch { /* ignore */ }
|
||||||
}
|
}
|
||||||
|
|
||||||
// One-time: 'waveform' style was renamed to 'truewave' (with 'pseudowave'
|
// 'waveform' style was renamed to 'truewave' (with 'pseudowave' added
|
||||||
// added as the deterministic legacy variant). Existing persisted value
|
// as the deterministic legacy variant). Any persisted value that is
|
||||||
// 'waveform' should land on the new bins-based default.
|
// not a valid SeekbarStyle (legacy 'waveform', undefined, tampered
|
||||||
const seekbarStyleMigrated = (state.seekbarStyle as string) === 'waveform'
|
// strings) lands on the new bins-based default — otherwise the
|
||||||
? { seekbarStyle: 'truewave' as SeekbarStyle }
|
// 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 {
|
const st = state as {
|
||||||
loudnessTargetLufs?: unknown;
|
loudnessTargetLufs?: unknown;
|
||||||
|
|||||||
Reference in New Issue
Block a user