From 19a724710cc11941342efed7672b243bacafa4a0 Mon Sep 17 00:00:00 2001 From: Terry Jia Date: Tue, 10 Feb 2026 16:09:54 -0500 Subject: [PATCH] fix: address review nits in load3d (#8779) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary - Refactor getModelUrl to use const instead of let - add missing language key improve for https://github.com/Comfy-Org/ComfyUI_frontend/pull/8765 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8779-fix-address-review-nits-in-load3d-3036d73d36508183af11c5e9bc545650) by [Unito](https://www.unito.io) --- src/composables/useLoad3d.ts | 21 +++++++-------------- src/locales/en/main.json | 1 + 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/composables/useLoad3d.ts b/src/composables/useLoad3d.ts index ac363f8909..a9972a0807 100644 --- a/src/composables/useLoad3d.ts +++ b/src/composables/useLoad3d.ts @@ -219,22 +219,15 @@ export const useLoad3d = (nodeOrRef: MaybeRef) => { return modelPath } - let cleanPath = modelPath.trim() - let forcedType: 'output' | 'input' | undefined - - if (cleanPath.endsWith('[output]')) { - cleanPath = cleanPath.replace(/\s*\[output\]$/, '').trim() - forcedType = 'output' - } + const trimmed = modelPath.trim() + const hasOutputSuffix = trimmed.endsWith('[output]') + const cleanPath = hasOutputSuffix + ? trimmed.replace(/\s*\[output\]$/, '') + : trimmed + const type = hasOutputSuffix || isPreview.value ? 'output' : 'input' const [subfolder, filename] = Load3dUtils.splitFilePath(cleanPath) - return api.apiURL( - Load3dUtils.getResourceURL( - subfolder, - filename, - forcedType ?? (isPreview.value ? 'output' : 'input') - ) - ) + return api.apiURL(Load3dUtils.getResourceURL(subfolder, filename, type)) } catch (error) { console.error('Failed to construct model URL:', error) return null diff --git a/src/locales/en/main.json b/src/locales/en/main.json index f5e238bb75..66ed1ec77c 100644 --- a/src/locales/en/main.json +++ b/src/locales/en/main.json @@ -2387,6 +2387,7 @@ "placeholderImage": "Select image...", "placeholderAudio": "Select audio...", "placeholderVideo": "Select video...", + "placeholderMesh": "Select mesh...", "placeholderModel": "Select model...", "placeholderUnknown": "Select media..." },