Update 3 IGetImageListener.imageReady call sites to v8 single-arg signature

IGetImageListener.imageReady(result: IImageResult) takes a single
IImageResult object (with .id, .data, .image), but three call sites in
the client still used the old 3-arg destructure '(id, texture, image)
=> ...'. The renderer's RoomEngine.ts already passes
'new ImageResult(...)' to the listener, so the runtime payload matches
the new contract; the old call-site shape just type-errored.

Migrated:
- LayoutPetImageView (pet thumbnail loader)
- LayoutRoomObjectImageView (furniture thumbnail loader)
- useFurniturePresentWidget (gift box image generator)

Also tightened imageFailed handlers from 'imageFailed: null' to a
proper no-op arrow — the interface requires a callback.
This commit is contained in:
simoleo89
2026-05-11 21:34:08 +02:00
parent a39aa37231
commit f57266af03
3 changed files with 21 additions and 11 deletions
+5 -3
View File
@@ -67,10 +67,12 @@ export const LayoutPetImageView: FC<LayoutPetImageViewProps> = props =>
if(petTypeId === 16) petHeadOnly = false; if(petTypeId === 16) petHeadOnly = false;
const imageResult = GetRoomEngine().getRoomObjectPetImage(petTypeId, petPaletteId, petColor1, new Vector3d((direction * 45)), 64, { const imageResult = GetRoomEngine().getRoomObjectPetImage(petTypeId, petPaletteId, petColor1, new Vector3d((direction * 45)), 64, {
imageReady: async (id, texture, image) => imageReady: async (result) =>
{ {
if(isDisposed.current) return; if(isDisposed.current) return;
const { image, data: texture } = result;
if(image) if(image)
{ {
setPetUrl(image.src); setPetUrl(image.src);
@@ -85,9 +87,9 @@ export const LayoutPetImageView: FC<LayoutPetImageViewProps> = props =>
setHeight(texture.height); setHeight(texture.height);
} }
}, },
imageFailed: (id) => imageFailed: () =>
{ {
// no-op
} }
}, petHeadOnly, 0, petCustomParts, posture); }, petHeadOnly, 0, petCustomParts, posture);
@@ -53,13 +53,16 @@ export const LayoutRoomObjectImageView: FC<LayoutRoomObjectImageViewProps> = pro
useEffect(() => useEffect(() =>
{ {
const imageResult = GetRoomEngine().getRoomObjectImage(roomId, objectId, category, new Vector3d(direction * 45), 64, { const imageResult = GetRoomEngine().getRoomObjectImage(roomId, objectId, category, new Vector3d(direction * 45), 64, {
imageReady: async (id, texture, image) => imageReady: async (result) =>
{ {
const img = await TextureUtils.generateImage(texture); const img = await TextureUtils.generateImage(result.data);
if(img && isMounted.current) setImageElement(img); if(img && isMounted.current) setImageElement(img);
}, },
imageFailed: null imageFailed: () =>
{
// no-op
}
}); });
if(!imageResult) return; if(!imageResult) return;
@@ -53,19 +53,24 @@ const useFurniturePresentWidgetState = () =>
{ {
// async fix image // async fix image
return { return {
imageReady: (id, texture, image) => imageReady: (result) =>
{ {
(async () => (async () =>
{ {
if(!image && texture) let image = result.image;
if(!image && result.data)
{ {
image = await TextureUtils.generateImage(texture); image = await TextureUtils.generateImage(result.data);
} }
setImageUrl(image.src); if(image) setImageUrl(image.src);
})(); })();
}, },
imageFailed: null imageFailed: () =>
{
// no-op
}
}; };
}, []); }, []);