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(iframe-view): can't turn pages after changing window size #1336

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

NoraH1to
Copy link

before fix:

before

after fix:

after

@NoraH1to
Copy link
Author

Because frequent resizing causes iframes to be destroyed before they are loaded, the onload of the iframe is not executed, which causes a promise to remain in a pending state and block the queue.

See the section I modified for details.

@@ -841,6 +847,9 @@ class IframeView {
this._height = null;
}

this.loading && this.loading.reject('cancel');
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure the promise doesn't get stuck in pending, this avoids queue blocking.

@@ -382,7 +387,8 @@ class IframeView {


load(contents) {
var loading = new defer();
this.loading && this.loading.reject('cancel');
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure the last promise is released.

Comment on lines +13 to +17
static ViewMap = new Map();
constructor(section, options) {
const oldView = IframeView.ViewMap.get(section.href);
if (oldView) oldView.destroy();
IframeView.ViewMap.set(section.href, this);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the previous instance of the current page is destroyed to prevent promise blocking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant