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): queue install-all silently with one summary toast
joshistoast1cc5f279444a
diff --git a/invokeai/frontend/webv2/public/locales/en.json b/invokeai/frontend/webv2/public/locales/en.jsonindex 97819c2d52..9763b23b08 100644--- a/invokeai/frontend/webv2/public/locales/en.json+++ b/invokeai/frontend/webv2/public/locales/en.json@@ -934,6 +934,9 @@"install": "Install","installAll": "Install all","installAllCount": "Install all ({{count}})",+ "installAllQueued": "Installs queued",+ "installAllQueuedDescription_one": "{{count}} install queued.",+ "installAllQueuedDescription_other": "{{count}} installs queued.","installBundle": "Install bundle","installFailed": "Install failed","installInPlace": "Install in place",diff --git a/invokeai/frontend/webv2/src/features/models/ui/add-models/AddModelsView.tsx b/invokeai/frontend/webv2/src/features/models/ui/add-models/AddModelsView.tsxindex e383bc8431..26f38b590c 100644--- a/invokeai/frontend/webv2/src/features/models/ui/add-models/AddModelsView.tsx+++ b/invokeai/frontend/webv2/src/features/models/ui/add-models/AddModelsView.tsx@@ -8,7 +8,7 @@ import {filterStarterModels,type StarterModelFilters,} from '@features/models/core/starters';-import { getHuggingFaceModels, scanFolderForModels } from '@features/models/data/api';+import { getHuggingFaceModels, scanFolderForModels, type InstallModelRequest } from '@features/models/data/api';import {ensureExternalProvidersLoaded,useExternalProvidersSelector,@@ -22,7 +22,6 @@ import {assertAccountScopeCurrent,captureAccountScope,isAccountScopeCurrent,- type AccountScope,} from '@platform/state/accountLifecycle';import { Button, Scrollable, Tooltip } from '@platform/ui';import { DownloadIcon, FileIcon, FolderIcon, FolderSearchIcon, LinkIcon, SearchIcon } from 'lucide-react';@@ -30,8 +29,6 @@ import { useDeferredValue, useMemo, useState } from 'react';import { useTranslation } from 'react-i18next';import { SiHuggingface } from 'react-icons/si';-import type { StarterInstallSource } from './starterModelInstallSources';-import { AccessTokenPopover } from './AccessTokenPopover';import { BundleChips } from './BundleChips';import { HuggingFaceFiles } from './HuggingFaceFiles';@@ -52,7 +49,7 @@ import { useInstallActions } from './useInstallActions';export const AddModelsView = () => {const { t } = useTranslation();const notify = useNotify();- const { install, pendingSources } = useInstallActions();+ const { install, installMany, pendingSources } = useInstallActions();const loadError = useStartersSelector((snapshot) => snapshot.error);const response = useStartersSelector((snapshot) => snapshot.response);const status = useStartersSelector((snapshot) => snapshot.status);@@ -146,27 +143,10 @@ export const AddModelsView = () => {[deferredTrimmed, sourceModels, starterFilters]);- const queueSources = async (entries: StarterInstallSource[], owner: AccountScope): Promise<number> => {- let queued = 0;-- for (const { config, source } of entries) {- if (!isAccountScopeCurrent(owner)) {- break;- }-- if (await install({ config, source }, { silent: true })) {- queued += 1;- }- }-- return queued;- };-const installStarter = async (model: StarterModel) => {const owner = captureAccountScope();- const queued = await queueSources(- getStarterModelInstallSources(model, { dependencySourcesToSkip: selectedBundleSources }),- owner+ const queued = await installMany(+ getStarterModelInstallSources(model, { dependencySourcesToSkip: selectedBundleSources }));if (queued > 0 && isAccountScopeCurrent(owner)) {@@ -188,7 +168,7 @@ export const AddModelsView = () => {setInstallingBundle(bundle.name);try {- const queued = await queueSources(getStarterBundleInstallSources(bundle), owner);+ const queued = await installMany(getStarterBundleInstallSources(bundle));if (queued > 0 && isAccountScopeCurrent(owner)) {notify.success(@@ -203,6 +183,18 @@ export const AddModelsView = () => {}};+ // Install-all from a results panel: silent per-model queueing with one+ // summary toast, the same shape the bundle path uses — never a toast per+ // file for a 40-file repo.+ const installAllSources = async (requests: InstallModelRequest[]) => {+ const owner = captureAccountScope();+ const queued = await installMany(requests);++ if (queued > 0 && isAccountScopeCurrent(owner)) {+ notify.success(t('models.installAllQueued'), t('models.installAllQueuedDescription', { count: queued }));+ }+ };+const handlePull = async () => {if (!kind.isInstallable) {return;@@ -397,6 +389,9 @@ export const AddModelsView = () => {pendingSources={pendingSources}onClear={() => updateModelsUi({ hfLookup: null })}onInstall={(url) => void install({ accessToken: token, source: url })}+ onInstallAll={(urls) =>+ void installAllSources(urls.map((url) => ({ accessToken: token, source: url })))+ }/>) : null}@@ -407,6 +402,7 @@ export const AddModelsView = () => {scan={scan}onClear={() => updateModelsUi({ scan: null })}onInstall={(path) => void install({ inplace, source: path })}+ onInstallAll={(paths) => void installAllSources(paths.map((path) => ({ inplace, source: path })))}onSetInplace={setInplace}/>) : null}diff --git a/invokeai/frontend/webv2/src/features/models/ui/add-models/HuggingFaceFiles.tsx b/invokeai/frontend/webv2/src/features/models/ui/add-models/HuggingFaceFiles.tsxindex 23af204f26..c06a6ee82d 100644--- a/invokeai/frontend/webv2/src/features/models/ui/add-models/HuggingFaceFiles.tsx+++ b/invokeai/frontend/webv2/src/features/models/ui/add-models/HuggingFaceFiles.tsx@@ -13,11 +13,14 @@ export const HuggingFaceFiles = ({lookup,onClear,onInstall,+ onInstallAll,pendingSources,}: {lookup: HFLookupState;onClear: () => void;onInstall: (url: string) => void;+ /** Bulk path: the parent queues silently and emits one summary toast. */+ onInstallAll: (urls: string[]) => void;pendingSources: ReadonlySet<string>;}) => {const { t } = useTranslation();@@ -35,9 +38,7 @@ export const HuggingFaceFiles = ({}, [deferredFilter, lookup.urls]);const installAll = () => {- for (const url of filteredUrls) {- onInstall(url);- }+ onInstallAll(filteredUrls);};return (diff --git a/invokeai/frontend/webv2/src/features/models/ui/add-models/ScanResults.tsx b/invokeai/frontend/webv2/src/features/models/ui/add-models/ScanResults.tsxindex 4772b7ea2f..e07ac64a41 100644--- a/invokeai/frontend/webv2/src/features/models/ui/add-models/ScanResults.tsx+++ b/invokeai/frontend/webv2/src/features/models/ui/add-models/ScanResults.tsx@@ -15,6 +15,7 @@ export const ScanResults = ({inplace,onClear,onInstall,+ onInstallAll,onSetInplace,pendingSources,scan,@@ -22,6 +23,8 @@ export const ScanResults = ({inplace: boolean;onClear: () => void;onInstall: (path: string) => void;+ /** Bulk path: the parent queues silently and emits one summary toast. */+ onInstallAll: (paths: string[]) => void;onSetInplace: (inplace: boolean) => void;pendingSources: ReadonlySet<string>;scan: { path: string; results: FoundModel[] };@@ -44,9 +47,7 @@ export const ScanResults = ({const installable = filteredResults.filter((result) => !result.is_installed);const installAll = () => {- for (const result of installable) {- onInstall(result.path);- }+ onInstallAll(installable.map((result) => result.path));};if (scan.results.length === 0) {diff --git a/invokeai/frontend/webv2/src/features/models/ui/add-models/useInstallActions.ts b/invokeai/frontend/webv2/src/features/models/ui/add-models/useInstallActions.tsindex a32a1a1888..a762f8e3ea 100644--- a/invokeai/frontend/webv2/src/features/models/ui/add-models/useInstallActions.ts+++ b/invokeai/frontend/webv2/src/features/models/ui/add-models/useInstallActions.ts@@ -68,5 +68,30 @@ export const useInstallActions = () => {[notify, t]);- return { install, pendingSources };+ /**+ * Queue many installs sequentially and silently; returns how many were+ * accepted so the caller can emit one summary. Failures still toast+ * individually via `install`'s error path.+ */+ const installMany = useCallback(+ async (requests: InstallModelRequest[]): Promise<number> => {+ const owner = captureAccountScope();+ let queued = 0;++ for (const request of requests) {+ if (!isAccountScopeCurrent(owner)) {+ break;+ }++ if (await install(request, { silent: true })) {+ queued += 1;+ }+ }++ return queued;+ },+ [install]+ );++ return { install, installMany, pendingSources };};