You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using dotlottie-js in toolkit-js dotLottie plugin, images with the same IdRef are not imported correctly if they appear in multiple animations within a single dotLottie file. This issue breaks the export process, even though the import process seems to work as expected.
The problem appears to be related to the image extraction logic, which fails in cases involving the same image IDs across multiple animations.
Here is a failing test to help reproduce
import{DotLottie,getAnimations,getImages}from'@dotlottie/dotlottie-js';test('create a dotLottie JS with many images from an existing .lottie file',async()=>{constdotLottieBuffer=readDotLottieFile('src/fixtures/image-assets.lottie');constanimations=awaitgetAnimations(newUint8Array(dotLottieBuffer),{inlineAssets: true});constimages=awaitgetImages(newUint8Array(dotLottieBuffer));constexpectedDotLottie=newDotLottie();for(constanimationinanimations){constanimationData=animations[animation];expectedDotLottie.addAnimation({id: animation,data: animationData,});}awaitexpectedDotLottie.build();expectedDotLottie.animations.forEach((expectedAnimation)=>{constactualAnimation=animations[expectedAnimation.id];expect(actualAnimation).toBeDefined();expect(actualAnimation).toStrictEqual(expectedAnimation.data);});constnotIdenticalImages=[];expectedDotLottie.getImages().forEach((expectedImage)=>{constimageUri=images[expectedImage.fileName];expect(imageUri).toBeDefined();expect(imageUri?.length).toBeGreaterThan(0);if(imageUri!==expectedImage.data){notIdenticalImages.push(expectedImage.fileName);}});expect(notIdenticalImages.length).toBe(0);});
It appears there's an issue in the creation process of the image-assets.lottie. The file was created using dotLottie-js on the dotLottie playground.
Here's a screenshot for the bull.json animation inside the .lottie file attached, showing that the first and second images are duplicates, although they are not in the original animation.
When using dotlottie-js in toolkit-js dotLottie plugin, images with the same IdRef are not imported correctly if they appear in multiple animations within a single dotLottie file. This issue breaks the export process, even though the import process seems to work as expected.
The problem appears to be related to the image extraction logic, which fails in cases involving the same image IDs across multiple animations.
Here is a failing test to help reproduce
image-assets.zip
The text was updated successfully, but these errors were encountered: