Skip to content
Open
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
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