fix fetch confirmation to only show on list query

This commit is contained in:
jeffvli
2025-12-07 03:14:38 -08:00
parent 56098c6617
commit 9dbee39d34
@@ -46,7 +46,6 @@ export interface PlayerContext {
id: string[], id: string[],
itemType: LibraryItem, itemType: LibraryItem,
type: AddToQueueType, type: AddToQueueType,
skipConfirmation?: boolean,
) => void; ) => void;
addToQueueByListQuery: ( addToQueueByListQuery: (
serverId: string, serverId: string,
@@ -236,20 +235,7 @@ export const PlayerProvider = ({ children }: { children: React.ReactNode }) => {
); );
const addToQueueByFetch = useCallback( const addToQueueByFetch = useCallback(
async ( async (serverId: string, id: string[], itemType: LibraryItem, type: AddToQueueType) => {
serverId: string,
id: string[],
itemType: LibraryItem,
type: AddToQueueType,
skipConfirmation?: boolean,
) => {
if (!skipConfirmation) {
const confirmed = await confirmLargeFetch();
if (!confirmed) {
return;
}
}
let toastId: null | string = null; let toastId: null | string = null;
const fetchId = nanoid(); const fetchId = nanoid();
@@ -331,7 +317,7 @@ export const PlayerProvider = ({ children }: { children: React.ReactNode }) => {
}); });
} }
}, },
[confirmLargeFetch, queryClient, storeActions, t], [queryClient, storeActions, t],
); );
const addToQueueByListQuery = useCallback( const addToQueueByListQuery = useCallback(
@@ -482,7 +468,7 @@ export const PlayerProvider = ({ children }: { children: React.ReactNode }) => {
if (itemType === LibraryItem.SONG) { if (itemType === LibraryItem.SONG) {
addToQueueByData(allResults as Song[], type); addToQueueByData(allResults as Song[], type);
} else { } else {
await addToQueueByFetch(serverId, allResults as string[], itemType, type, true); await addToQueueByFetch(serverId, allResults as string[], itemType, type);
} }
} catch (err: any) { } catch (err: any) {
if (instanceOfCancellationError(err)) { if (instanceOfCancellationError(err)) {