mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-09 20:29:36 +02:00
validate that the current song is different from server before revalidating in queue
This commit is contained in:
@@ -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,15 +37,20 @@ export const useUpdateCurrentSong = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (updatedSong) {
|
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', {
|
if (!isEqual(currentSongData, updatedSong)) {
|
||||||
category: LogCategory.PLAYER,
|
updateQueueSong(currentSong.id, updatedSong);
|
||||||
meta: {
|
|
||||||
id: currentSong.id,
|
logFn.debug('Song updated in queue', {
|
||||||
name: updatedSong.name,
|
category: LogCategory.PLAYER,
|
||||||
},
|
meta: {
|
||||||
});
|
id: currentSong.id,
|
||||||
|
name: updatedSong.name,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logFn.error('Failed to update song in queue', {
|
logFn.error('Failed to update song in queue', {
|
||||||
|
|||||||
Reference in New Issue
Block a user