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(preview): keep in-progress preview off after the user disables it (#9868)
Josh Corbett50f340499fc2
diff --git a/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts b/invokeai/frontend/webv2/src/workbench/workbenchState.test.tsindex 80c9f9b140..be7b77ad3e 100644--- a/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts+++ b/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts@@ -5601,6 +5601,26 @@ describe('workbenchReducer Phase 5 generation flow', () => {expect(getActiveProject(state).settings.showProgressImagesInViewer).toBe(false);});+ it('keeps an explicit live-follow opt-out through later Gallery selections and submissions', () => {+ let state = primeGenerate();+ state = workbenchReducer(state, { destination: 'gallery', type: 'setInvocationDestination' });+ state = workbenchReducer(state, {+ settings: { showProgressImagesInViewer: false },+ type: 'setActiveProjectSettings',+ });+ state = workbenchReducer(state, { item: createGalleryImageItem('selected.png'), type: 'selectGalleryItem' });+ state = workbenchReducer(state, {+ image: createGalleryImageItem('compare.png'),+ type: 'setGalleryCompareImage',+ });++ state = submitGenerate(state);++ const project = getActiveProject(state);+ expect(project.settings.showProgressImagesInViewer).toBe(false);+ expect(getProjectWidgetValues(project, 'gallery').selectedImageName).toBe('image:selected.png');+ });+it('lifts the selection pause when live-follow is toggled explicitly', () => {let state = createInitialWorkbenchState();state = workbenchReducer(state, { item: createGalleryImageItem('selected.png'), type: 'selectGalleryItem' });diff --git a/invokeai/frontend/webv2/src/workbench/workbenchState.ts b/invokeai/frontend/webv2/src/workbench/workbenchState.tsindex 4bd67fd72e..4687858eeb 100644--- a/invokeai/frontend/webv2/src/workbench/workbenchState.ts+++ b/invokeai/frontend/webv2/src/workbench/workbenchState.ts@@ -3153,29 +3153,35 @@ const reconcileDeletedGalleryBoard = (return didChangeQueue ? { ...withBoardReferencesCleared, projects } : withBoardReferencesCleared;};-/** A deliberate selection pauses live-follow; only generations submitted after that selection may take the preview. */+const getLiveFollowPausedAt = (project: Project): string | null => {+ const pausedAt = getWidgetValues(project, 'gallery').liveFollowPausedAt;++ return typeof pausedAt === 'string' ? pausedAt : null;+};++/**+ * A deliberate selection pauses live-follow; only generations submitted after that selection may take the preview.+ * With live-follow explicitly off there is nothing to pause, and a pause recorded then would let the next submission+ * turn it back on.+ */const updateGalleryValuesAndPauseLiveFollow = (state: WorkbenchState,getValues: (values: Record<string, unknown>) => Record<string, unknown>,projectId = state.activeProjectId): WorkbenchState =>updateProjectById(state, projectId, (project) =>- updateProjectWidgetValues(- {- ...project,- settings: { ...project.settings, showProgressImagesInViewer: false },- },- 'gallery',- (values) => ({ ...getValues(values), liveFollowPausedAt: now() })- )+ !project.settings.showProgressImagesInViewer && getLiveFollowPausedAt(project) === null+ ? updateProjectWidgetValues(project, 'gallery', getValues)+ : updateProjectWidgetValues(+ {+ ...project,+ settings: { ...project.settings, showProgressImagesInViewer: false },+ },+ 'gallery',+ (values) => ({ ...getValues(values), liveFollowPausedAt: now() })+ ));-const getLiveFollowPausedAt = (project: Project): string | null => {- const pausedAt = getWidgetValues(project, 'gallery').liveFollowPausedAt;-- return typeof pausedAt === 'string' ? pausedAt : null;-};-/** Submission resumes selection-paused live-follow, but preserves an explicit opt-out. */const shouldResumeLiveFollowOnSubmit = (project: Project): boolean =>!project.settings.showProgressImagesInViewer && getLiveFollowPausedAt(project) !== null;