From 291daa434c0d88d992d80a50bfce30cc68474850 Mon Sep 17 00:00:00 2001 From: jeffvli Date: Sat, 17 Jan 2026 13:19:56 -0800 Subject: [PATCH] validate that the current song is different from server before revalidating in queue --- .../player/hooks/use-update-current-song.ts | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/renderer/features/player/hooks/use-update-current-song.ts b/src/renderer/features/player/hooks/use-update-current-song.ts index 67d38ddfb..f403719e3 100644 --- a/src/renderer/features/player/hooks/use-update-current-song.ts +++ b/src/renderer/features/player/hooks/use-update-current-song.ts @@ -1,4 +1,5 @@ import { useQueryClient } from '@tanstack/react-query'; +import isEqual from 'lodash/isEqual'; import { useCallback } from 'react'; import { api } from '/@/renderer/api'; @@ -36,15 +37,20 @@ export const useUpdateCurrentSong = () => { }); if (updatedSong) { - updateQueueSong(currentSong.id, updatedSong); + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const { _uniqueId, ...currentSongData } = currentSong; - logFn.debug('Song updated in queue', { - category: LogCategory.PLAYER, - meta: { - id: currentSong.id, - name: updatedSong.name, - }, - }); + if (!isEqual(currentSongData, updatedSong)) { + updateQueueSong(currentSong.id, updatedSong); + + logFn.debug('Song updated in queue', { + category: LogCategory.PLAYER, + meta: { + id: currentSong.id, + name: updatedSong.name, + }, + }); + } } } catch (error) { logFn.error('Failed to update song in queue', {