Skip to content

Commit

Permalink
fix: fix disableCssAnimation bug when using multiple viewports
Browse files Browse the repository at this point in the history
  • Loading branch information
wadackel committed Jun 20, 2022
1 parent ada0d97 commit 2bdab36
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/storycap/src/node/capturing-browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ export class CapturingBrowser extends StoryPreviewBrowser {
Object.entries(exposed).forEach(([k, f]) => this.page.exposeFunction(k, f));
}

private async reload() {
await this.page.reload();
await sleep(this.opt.viewportDelay);
await this.addStyles();
}

private async waitIfTouched() {
if (!this.touched) return;
await sleep(this.opt.stateChangeDelay);
Expand Down Expand Up @@ -255,7 +261,7 @@ export class CapturingBrowser extends StoryPreviewBrowser {
this.viewport = nextViewport;
if (willBeReloaded || this.opt.reloadAfterChangeViewport) {
this.processedStories.delete(this.currentRequestId);
await Promise.all([this.page.reload(), this.waitForOptionsFromBrowser()]);
await Promise.all([this.reload(), this.waitForOptionsFromBrowser()]);
} else {
await sleep(this.opt.viewportDelay);
}
Expand Down

0 comments on commit 2bdab36

Please sign in to comment.