mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-09 20:29:36 +02:00
fix fetch confirmation to only show on list query
This commit is contained in:
@@ -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)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user