From ce34c6d37bc868f6ecc871bf32e23b6ac30d75f8 Mon Sep 17 00:00:00 2001 From: Josh Faigan Date: Wed, 18 Feb 2026 14:17:21 -0500 Subject: [PATCH] Amend downloadFiles loop to a Promise.all to ensure writes are complete --- .changeset/free-suns-stand.md | 5 +++++ packages/theme/src/cli/utilities/theme-downloader.ts | 7 ++----- 2 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 .changeset/free-suns-stand.md diff --git a/.changeset/free-suns-stand.md b/.changeset/free-suns-stand.md new file mode 100644 index 00000000000..b1dd013b48c --- /dev/null +++ b/.changeset/free-suns-stand.md @@ -0,0 +1,5 @@ +--- +'@shopify/theme': patch +--- + +Change download files loop to a Promise all to ensure all files are always downloaded and display more accurate progress diff --git a/packages/theme/src/cli/utilities/theme-downloader.ts b/packages/theme/src/cli/utilities/theme-downloader.ts index fae80deb311..f0841361f54 100644 --- a/packages/theme/src/cli/utilities/theme-downloader.ts +++ b/packages/theme/src/cli/utilities/theme-downloader.ts @@ -2,7 +2,7 @@ import {batchedTasks, Task} from './batching.js' import {MAX_GRAPHQL_THEME_FILES} from '../constants.js' import {AdminSession} from '@shopify/cli-kit/node/session' import {fetchThemeAssets} from '@shopify/cli-kit/node/themes/api' -import {ThemeFileSystem, Theme, Checksum, ThemeAsset} from '@shopify/cli-kit/node/themes/types' +import {ThemeFileSystem, Theme, Checksum} from '@shopify/cli-kit/node/themes/types' import {renderTasks} from '@shopify/cli-kit/node/ui' import {Writable} from 'stream' @@ -90,8 +90,5 @@ async function downloadFiles(theme: Theme, fileSystem: ThemeFileSystem, filename const assets = await fetchThemeAssets(theme.id, filenames, session) if (!assets) return - // eslint-disable-next-line @typescript-eslint/no-misused-promises - assets.forEach(async (asset: ThemeAsset) => { - await fileSystem.write(asset) - }) + await Promise.all(assets.map((asset) => fileSystem.write(asset))) }