chengww
|
761884f23a
|
refactor(playHistory): 持久化重写,统一防抖落盘与序列化兜底
把 playHistory 接入 utils/debouncedStorage 与 utils/persistedSong,
配合 add* 方法重构与 clearAll 同步落盘,闭合 localStorage 配额防护。
- musicHistory 类型从 SongResult 收敛到 MusicHistoryItem(精简子集),
导出 MinifiedDjProgram、stripBase64Covers,给 podcast/playlist/album/
podcastRadio 历史也做顶层 picUrl/coverImgUrl/coverUrl 的 base64 兜底
- serializePlayHistoryState 提取为模块级函数,给 persistedstate.serializer
与 clearAll 同步落盘共用,避免格式漂移;isPodcast/program 字段必须
保留——playbackController.playTrack 用 isPodcast 决定写哪条历史
- 5 个 add* 全部重写成单步 ref 重赋值,避免 splice/pop/unshift 多次
触发 watch 与持久化;命中已有条目时累加 count + 刷新 lastPlayTime,
picUrl/al 用新数据覆盖(封面可能换了短引用)
- clearAll 增加 flushDebouncedStorage + 同步 setItem 空状态,防止
kill -9 落在 2s 防抖窗口里导致旧历史残留
- heatmap/index.vue 类型切到 MusicHistoryItem,移除 music.artists
兜底(minifySong 已合并 ar/artists,只剩 ar)
|
2026-05-17 23:08:22 +08:00 |
|