Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

Commit

Permalink
Use once instead of on to avoid conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
shilman committed Aug 20, 2023
1 parent e351cc7 commit 279ad0a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ const fixtures: Fixtures<
*/
const waitForStoryRender = async (updateFn: () => void) =>
new Promise((resolve, reject) => {
channel.on('storyRendered', () => resolve(void 0));
channel.on('storyUnchanged', () => resolve(void 0));
channel.on('storyErrored', (error) => reject(error));
channel.on('storyThrewException', (error) => reject(error));
channel.on('playFunctionThrewException', (error) => reject(error));
channel.on('storyMissing', (id) => id === storyId && reject(`Missing story ${id}`));
channel.once('storyRendered', () => resolve(void 0));
channel.once('storyUnchanged', () => resolve(void 0));
channel.once('storyErrored', (error) => reject(error));
channel.once('storyThrewException', (error) => reject(error));
channel.once('playFunctionThrewException', (error) => reject(error));
channel.once('storyMissing', (id) => id === storyId && reject(`Missing story ${id}`));
updateFn();
});

Expand Down

0 comments on commit 279ad0a

Please sign in to comment.