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): skip concept writes for rows removed mid-edit
Josh Corbett5a9778fbc606
diff --git a/invokeai/frontend/webv2/src/app/ConceptDraftCommits.browser.test.tsx b/invokeai/frontend/webv2/src/app/ConceptDraftCommits.browser.test.tsxindex 94e2374581..12925c4e12 100644--- a/invokeai/frontend/webv2/src/app/ConceptDraftCommits.browser.test.tsx+++ b/invokeai/frontend/webv2/src/app/ConceptDraftCommits.browser.test.tsx@@ -225,4 +225,23 @@ describe('concept drafts through widget adapters', () => {}});++ it.each(['upscale', 'video'] as const)(+ 'writes only the removal when a %s row is removed with its own pending weight',+ async (widget) => {+ const rows = await render(widget);+ await act(() => step(rows[0]!));+ const projects = new Set<Project>();+ const unsubscribe = store.subscribe(() => projects.add(store.getSnapshot().activeProject));++ await act(() => {+ rows[0]!.querySelector<HTMLButtonElement>('[aria-label="widgets.generate.removeConceptNamed"]')?.click();+ });+ await act(() => flushWorkbenchDrafts());+ unsubscribe();++ expect(projects.size).toBe(1);+ expect(currentLoras(widget).map((lora) => lora.model.key)).toEqual([`${widget}-second`]);+ }+ );});diff --git a/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx b/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsxindex 9242a420a9..824be0be23 100644--- a/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx+++ b/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx@@ -361,9 +361,12 @@ export const UpscaleWidgetView = () => {);const updateLora = useCallback((key: string, update: Partial<GenerateLora>) =>- patchValues((current) => ({- loras: current.loras.map((lora) => (lora.model.key === key ? { ...lora, ...update } : lora)),- })),+ // A row removed mid-edit still flushes its draft; that must not write an unchanged list.+ patchValues((current) =>+ current.loras.some((lora) => lora.model.key === key)+ ? { loras: current.loras.map((lora) => (lora.model.key === key ? { ...lora, ...update } : lora)) }+ : {}+ ),[patchValues]);const removeLora = useCallback(diff --git a/invokeai/frontend/webv2/src/features/video/ui/VideoConceptsSection.tsx b/invokeai/frontend/webv2/src/features/video/ui/VideoConceptsSection.tsxindex 6756ec861a..eab3e76d4e 100644--- a/invokeai/frontend/webv2/src/features/video/ui/VideoConceptsSection.tsx+++ b/invokeai/frontend/webv2/src/features/video/ui/VideoConceptsSection.tsx@@ -64,7 +64,12 @@ export const VideoConceptsSection = memo();const updateLora = useCallback((key: string, update: Partial<GenerateLora>) =>- onChangeLoras((current) => current.map((lora) => (lora.model.key === key ? { ...lora, ...update } : lora))),+ // A row removed mid-edit still flushes its draft; returning the list unchanged makes that a no-op.+ onChangeLoras((current) =>+ current.some((lora) => lora.model.key === key)+ ? current.map((lora) => (lora.model.key === key ? { ...lora, ...update } : lora))+ : current+ ),[onChangeLoras]);const removeLora = useCallback(diff --git a/invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx b/invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsxindex 7d069652d4..bf044f786b 100644--- a/invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx+++ b/invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx@@ -360,6 +360,10 @@ export const VideoWidgetView = () => {let notice: Parameters<typeof toaster.create>[0] | undefined;patchValues((current) => {const loras = update(current.loras);++ if (loras === current.loras) {+ return {};+ }// While enabled, follow a replacement accelerator set or restore model sampling defaults if none remains.// Preserve the edit and notify; never enable acceleration from a list edit.if (!current.model) {