Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix disableCssAnimation bug when using multiple viewports #610

Merged
merged 2 commits into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"deploy:ci": "lerna run clean && yarn build && lerna publish --yes from-package",
"deploy:manual": "lerna run clean && yarn build && lerna publish",
"deploy:pages": "gh-pages -d dist-pages -m \"[ci skip]\"",
"linkall": "lerna exec --parallel yarn link",
"unlinkall": "lerna exec --parallel --bail=false yarn unlink",
"postinstall": "husky install"
},
"repository": {
Expand Down
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