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.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
fix(ui): restore offline preset defaults
joshistoast2bc76f7d26a2
diff --git a/invokeai/frontend/webv2/src/workbench/projects/syncedPersistence.test.ts b/invokeai/frontend/webv2/src/workbench/projects/syncedPersistence.test.tsindex c13d79e1cd..7e25abab2f 100644--- a/invokeai/frontend/webv2/src/workbench/projects/syncedPersistence.test.ts+++ b/invokeai/frontend/webv2/src/workbench/projects/syncedPersistence.test.ts@@ -360,6 +360,32 @@ describe('loadWorkbench session hydration', () => {).toMatchObject({ destination: 'canvas', sourceId: 'canvas' });});+ it('starts an account-resolved draft from an empty offline session', async () => {+ const initial = createInitialWorkbenchState();+ const state: WorkbenchState = {+ ...initial,+ account: {+ ...initial.account,+ layoutPresetRouteOverrides: {+ compose: { destination: 'canvas', sourceId: 'canvas' },+ },+ },+ activeProjectId: '',+ projects: [],+ };++ storage.set(+ 'invokeai:v7:webv2:workbench',+ JSON.stringify({ savedAt: '2026-07-19T00:00:00.000Z', state, version: 1 })+ );+ api.listProjects.mockRejectedValueOnce(new Error('offline'));++ const snapshot = await service.loadWorkbench();++ expect(snapshot?.state.projects).toHaveLength(1);+ expect(snapshot?.state.projects[0]?.invocation).toMatchObject({ destination: 'canvas', sourceId: 'canvas' });+ });+it('reopens the cached session when the backend is unreachable and no draft was requested', async () => {const state = createInitialWorkbenchState();diff --git a/invokeai/frontend/webv2/src/workbench/projects/syncedPersistence.ts b/invokeai/frontend/webv2/src/workbench/projects/syncedPersistence.tsindex 14e8c663ba..12a11fae2e 100644--- a/invokeai/frontend/webv2/src/workbench/projects/syncedPersistence.ts+++ b/invokeai/frontend/webv2/src/workbench/projects/syncedPersistence.ts@@ -1025,12 +1025,22 @@ export const createSyncedWorkbenchPersistence = (),});- // A cache holding an empty session (last tab closed offline) cannot- // hydrate the editor; boot a fresh draft instead.- if (!local || local.state.projects.length === 0) {+ if (!local) {return null;}+ // A cache holding an empty session (last tab closed offline) still+ // owns the account's preset defaults, so build the replacement draft+ // here instead of falling back to the store's shipped defaults.+ if (local.state.projects.length === 0) {+ const draft = createDraftProject([], local.state.account);++ return {+ ...local,+ state: { ...local.state, activeProjectId: draft.id, projects: [draft] },+ };+ }+// `?new=true` means a fresh draft whether or not the backend answered.// Returning the cache verbatim here used to hand the caller whichever// project was last active, so an offline "New project" silently