同步时会下载音乐

This commit is contained in:
史悦
2026-01-06 15:03:06 +08:00
parent 87599a4ce8
commit 1af86ed6a6
3 changed files with 158 additions and 4 deletions

View File

@@ -851,9 +851,10 @@
const handleSync = async () => {
if (!syncToken) return;
// Sync Favorites
const cloudFavorites = await syncService.get('favorites', syncToken);
if (cloudFavorites && Array.isArray(cloudFavorites)) {
// Merge strategy: Combine unique songs by ID
setFavorites(prev => {
const combined = [...prev];
cloudFavorites.forEach(cloudSong => {
@@ -864,6 +865,11 @@
return combined;
});
}
// Also push current favorites to cloud to ensure sync
if (favorites.length > 0) {
syncService.set('favorites', favorites, syncToken);
}
};
useEffect(() => {