validate that the current song is different from server before revalidating in queue

This commit is contained in:
jeffvli
2026-01-17 13:19:56 -08:00
parent ef5daad1dd
commit 291daa434c
@@ -1,4 +1,5 @@
import { useQueryClient } from '@tanstack/react-query'; import { useQueryClient } from '@tanstack/react-query';
import isEqual from 'lodash/isEqual';
import { useCallback } from 'react'; import { useCallback } from 'react';
import { api } from '/@/renderer/api'; import { api } from '/@/renderer/api';
@@ -36,6 +37,10 @@ export const useUpdateCurrentSong = () => {
}); });
if (updatedSong) { if (updatedSong) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { _uniqueId, ...currentSongData } = currentSong;
if (!isEqual(currentSongData, updatedSong)) {
updateQueueSong(currentSong.id, updatedSong); updateQueueSong(currentSong.id, updatedSong);
logFn.debug('Song updated in queue', { logFn.debug('Song updated in queue', {
@@ -46,6 +51,7 @@ export const useUpdateCurrentSong = () => {
}, },
}); });
} }
}
} catch (error) { } catch (error) {
logFn.error('Failed to update song in queue', { logFn.error('Failed to update song in queue', {
category: LogCategory.PLAYER, category: LogCategory.PLAYER,