Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/vue-frame-interpolation-default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lottiefiles/dotlottie-vue': patch
---

fix(vue): keep frame interpolation enabled when `useFrameInterpolation` is omitted
6 changes: 5 additions & 1 deletion packages/vue/src/dotlottie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ export const DotLottieVue = defineComponent({
speed: { type: Number as PropType<DotLottieVueProps['speed']>, required: false },
volume: { type: Number as PropType<DotLottieVueProps['volume']>, required: false },
src: { type: String as PropType<DotLottieVueProps['src']>, required: false },
useFrameInterpolation: { type: Boolean as PropType<DotLottieVueProps['useFrameInterpolation']>, required: false },
useFrameInterpolation: {
type: Boolean as PropType<DotLottieVueProps['useFrameInterpolation']>,
required: false,
default: undefined,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried it locally, works. Can you also update packages/vue/README.md line 78? The default column still says false.

},
marker: { type: String as PropType<DotLottieVueProps['marker']>, required: false },
playOnHover: { type: Boolean as PropType<DotLottieVueProps['playOnHover']>, required: false },
themeData: { type: String as PropType<DotLottieVueProps['themeData']>, required: false },
Expand Down
30 changes: 30 additions & 0 deletions packages/vue/tests/dotlottie-vue.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,33 @@ describe('DotLottieVue themeData', () => {
});
});
});

describe('DotLottieVue useFrameInterpolation', () => {
let app: App | undefined;

afterEach(() => {
app?.unmount();
app = undefined;
});

test('keeps the core default (true) when the prop is omitted', async () => {
let component: DotLottieVueInstance | null = null;

app = createApp({
render: () =>
h(DotLottieVue, {
src: lottieSrc,
ref: (el: unknown) => {
component = el as DotLottieVueInstance | null;
},
}),
});
app.mount(document.body.appendChild(document.createElement('div')));

await vi.waitFor(() => {
expect(component?.getDotLottieInstance()?.isLoaded).toBe(true);
});

expect(component?.getDotLottieInstance()?.useFrameInterpolation).toBe(true);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix! This line is what's breaking Type Check. component is only assigned inside closures, so TS thinks it's still null here.

Can you move mount() (plus app and the afterEach) out of the themeData block to file scope and reuse it? Then this is just instance().useFrameInterpolation.

});
});
Loading