Skip to content

Commit

Permalink
fix: add async and await explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyuu33 committed Mar 31, 2024
1 parent ee3e1c9 commit a89f409
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/storycrawler/src/browser/stories-browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,17 @@ export class StoriesBrowser extends BaseBrowser {
timeout: 60_000,
},
);
await this.page.waitForTimeout(500);
await this.page.evaluate(() => {
await this.page.evaluate(async () => {
const api = (window as ExposedWindow).__STORYBOOK_CLIENT_API__ || (window as ExposedWindow).__STORYBOOK_PREVIEW__;
function isPreviewApi(api: API | PreviewAPI): api is PreviewAPI {
return (api as PreviewAPI).storyStoreValue !== undefined;
}
if (api === undefined) return;

if (isPreviewApi(api)) {
return api.storyStoreValue && api.storyStoreValue.cacheAllCSFFiles();
return api.storyStoreValue && (await api.storyStoreValue.cacheAllCSFFiles());
}
return api.storyStore?.cacheAllCSFFiles && api.storyStore.cacheAllCSFFiles();
return api.storyStore?.cacheAllCSFFiles && (await api.storyStore.cacheAllCSFFiles());
});
const result = await this.page.evaluate(() => {
function isPreviewApi(api: API | PreviewAPI): api is PreviewAPI {
Expand Down

0 comments on commit a89f409

Please sign in to comment.