Skip to content

fix(iframe-view): can't turn pages after changing window size#1336

Open
NoraH1to wants to merge 2 commits intofuturepress:masterfrom
NoraH1to:fix-cant-turn-the-page
Open

fix(iframe-view): can't turn pages after changing window size#1336
NoraH1to wants to merge 2 commits intofuturepress:masterfrom
NoraH1to:fix-cant-turn-the-page

Conversation

@NoraH1to
Copy link
Copy Markdown

before fix:

before

after fix:

after

@NoraH1to
Copy link
Copy Markdown
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.

this._height = null;
}

this.loading && this.loading.reject('cancel');
Copy link
Copy Markdown
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.


load(contents) {
var loading = new defer();
this.loading && this.loading.reject('cancel');
Copy link
Copy Markdown
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
Copy Markdown
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.

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
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.

1 participant