Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

fix(queue): list recovery projects without nextunique cursors on iOS Safari (#10229)

Lincoln Steindc78e6b4453f
diff --git a/invokeai/frontend/webv2/src/workbench/queue-integration/queueRunJournal.ts b/invokeai/frontend/webv2/src/workbench/queue-integration/queueRunJournal.ts
index e95e7f594d..edb7c90166 100644
--- a/invokeai/frontend/webv2/src/workbench/queue-integration/queueRunJournal.ts
+++ b/invokeai/frontend/webv2/src/workbench/queue-integration/queueRunJournal.ts
@@ -264,12 +264,15 @@ export const createIndexedDbQueueRunJournal = (
try {
const transaction = observeTransaction(database.transaction(WORKBENCH_QUEUE_RUN_STORE));
const projectIds: string[] = [];
- let cursor = await transaction.store.index('byProject').openKeyCursor(undefined, 'nextunique');
+ // iOS WebKit fails 'nextunique' index cursors ("Unable to open cursor"), so skip each project's
+ // remaining runs by continuing to the smallest string after its id.
+ let cursor = await transaction.store.index('byProject').openKeyCursor();
while (cursor) {
- if (isNonEmptyString(cursor.key)) {
- projectIds.push(cursor.key);
+ const { key } = cursor;
+ if (isNonEmptyString(key)) {
+ projectIds.push(key);
}
- cursor = await cursor.continue();
+ cursor = await (typeof key === 'string' ? cursor.continue(`${key}\u0000`) : cursor.continue());
}
await transaction.done;
return { kind: 'available', projectIds };