From c964c61a2ea3f122ca69aac81108a2c8be96e91a Mon Sep 17 00:00:00 2001 From: WuYongJie Date: Thu, 11 Jun 2026 21:42:30 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E7=BB=9F=E4=B8=80=E6=9D=90=E8=B4=A8?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E9=A2=84=E8=A7=88=E7=9B=B4=E8=BF=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/app/admin/materials/MaterialEditor.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/furniture-3d-system/src/app/admin/materials/MaterialEditor.tsx b/furniture-3d-system/src/app/admin/materials/MaterialEditor.tsx index aa3135e8..6e195094 100644 --- a/furniture-3d-system/src/app/admin/materials/MaterialEditor.tsx +++ b/furniture-3d-system/src/app/admin/materials/MaterialEditor.tsx @@ -14,7 +14,7 @@ import { useToast } from '@/components/ui/Toast' import { Image } from '@/components/ui/Image' import MobileCameraFileInput from '@/components/mobile/MobileCameraFileInput' import { buildMaterialThumbnailPreviewUrl } from '@/lib/material-thumbnail' -import { normalizeMaterialAssetPath } from '@/lib/material-asset-path' +import { resolveMaterialAssetUrlForClientAccess } from '@/lib/material-asset-path' import type { MaterialCategoryWithMaterials } from '@/lib/3d/material-manager' interface MaterialData { @@ -418,10 +418,16 @@ function TextureField({ const [uploading, setUploading] = useState(false) const previewUrl = useMemo(() => { + const directPreviewUrl = resolveMaterialAssetUrlForClientAccess(value) if (type === 'thumbnail') { - return buildMaterialThumbnailPreviewUrl({ thumbnailUrl: value, name: label, categoryName: category }, { preferThumbnail: true }) + return directPreviewUrl + || buildMaterialThumbnailPreviewUrl( + { thumbnailUrl: value, name: label, categoryName: category }, + { preferThumbnail: true }, + ) } - return normalizeMaterialAssetPath(value) || buildMaterialThumbnailPreviewUrl({ textureUrl: value, name: label, categoryName: category }) + return directPreviewUrl + || buildMaterialThumbnailPreviewUrl({ textureUrl: value, name: label, categoryName: category }) }, [category, label, type, value]) const canPreview = type === 'thumbnail' || Boolean(value)