Skip to content

Commit 0dd561e

Browse files
committed
cleanup
1 parent 7f7d51f commit 0dd561e

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

code/renderers/svelte/src/render.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ export async function renderToCanvas(
8080
target: canvasElement,
8181
props,
8282
});
83-
await svelte.tick();
8483
componentsByDomElement.set(canvasElement, { mountedComponent, props });
84+
await svelte.tick();
8585
} else {
8686
// We need to mutate the existing props for Svelte reactivity to work, we can't just re-assign them
8787
Object.assign(existingComponent.props, {

code/renderers/svelte/template/stories/settled.stories.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type { StoryObj } from '@storybook/svelte';
22

33
import { expect, fn, waitFor } from 'storybook/test';
44

5-
// import * as svelte from 'svelte';
65
import AsyncComponent from './AsyncComponent.svelte';
76
import SyncComponent from './SyncComponent.svelte';
87

@@ -41,9 +40,12 @@ export const Async: StoryObj<typeof AsyncComponent> = {
4140
// TODO: Ideally we should be able to call await svelte.settled() here instead of waitFor, but currently there's a bug making it never resolve
4241
// await svelte.settled();
4342

44-
await waitFor(() => {
45-
expect(args.onEffect).toHaveBeenCalledOnce();
46-
expect(canvas.getByTestId('after-effect')).toBeInTheDocument();
43+
await waitFor(async () => {
44+
await expect(args.onEffect).toHaveBeenCalledOnce();
45+
await expect(canvas.getByTestId('after-effect')).toBeInTheDocument();
46+
await expect(
47+
canvasElement.querySelector('#sb-pending-async-component-notice')
48+
).not.toBeInTheDocument();
4749
});
4850
},
4951
};

0 commit comments

Comments
 (0)