-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
base: master
Are you sure you want to change the base?
Conversation
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'); |
There was a problem hiding this comment.
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'); |
There was a problem hiding this comment.
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.
static ViewMap = new Map(); | ||
constructor(section, options) { | ||
const oldView = IframeView.ViewMap.get(section.href); | ||
if (oldView) oldView.destroy(); | ||
IframeView.ViewMap.set(section.href, this); |
There was a problem hiding this comment.
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.
before fix:
after fix: