fix(iframe-view): can't turn pages after changing window size#1336
Open
NoraH1to wants to merge 2 commits intofuturepress:masterfrom
Open
fix(iframe-view): can't turn pages after changing window size#1336NoraH1to wants to merge 2 commits intofuturepress:masterfrom
NoraH1to wants to merge 2 commits intofuturepress:masterfrom
Conversation
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. |
NoraH1to
commented
May 21, 2023
| this._height = null; | ||
| } | ||
|
|
||
| this.loading && this.loading.reject('cancel'); |
Author
There was a problem hiding this comment.
Make sure the promise doesn't get stuck in pending, this avoids queue blocking.
NoraH1to
commented
May 21, 2023
|
|
||
| load(contents) { | ||
| var loading = new defer(); | ||
| this.loading && this.loading.reject('cancel'); |
Author
There was a problem hiding this comment.
Make sure the last promise is released.
NoraH1to
commented
May 21, 2023
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); |
Author
There was a problem hiding this comment.
Ensure that the previous instance of the current page is destroyed to prevent promise blocking.
hiive
pushed a commit
to hiive/epub.js
that referenced
this pull request
Apr 6, 2026
…urepress#1128, futurepress#1308, futurepress#1336, futurepress#1300 - futurepress#1129: Fix locationOf crash on empty ranges — use parentElement fallback - futurepress#1128: Fix fractional scrollLeft causing stuck navigation — Math.floor - futurepress#1308: Fix float rounding in vertical bottom detection (2199.99 vs 2200) - futurepress#1336: Fix can't turn pages after resize — ViewMap cleanup, always destroy - futurepress#1300: Remove outdated WebKit range workaround for hash links
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
before fix:
after fix: