-
-
Notifications
You must be signed in to change notification settings - Fork 255
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
Foliate keep opening the same page #653
Comments
If you do the following:
Does it go to the correct page? |
Yes, it goes. |
Okay, I think I can reproduce this problem. It seems the problem is that, when a chapter (spine item) is not yet loaded, so for some reason, Epub.js has trouble going to locations after a certain point in that chapter. After the chapter is loaded, the problem no longer occurs. This can be verified by:
So a quick fix is probably just go to the saved location twice: diff --git a/src/web/epub-viewer.js b/src/web/epub-viewer.js
index 5d80be7..dd67d85 100644
--- a/src/web/epub-viewer.js
+++ b/src/web/epub-viewer.js
@@ -470,6 +470,7 @@ const loadLocations = async locations => {
const display = lastLocation =>
rendition.display(lastLocation)
+ .then(() => rendition.display(lastLocation))
.then(() => dispatch({ type: 'book-displayed' }))
// get book cover for "about this book" dialogue |
@johnfactotum This fix of going to location twice has been known for some time. There may even be an old bug or discussion that was closed. |
I do remember putting that in the code at some point (seems to be d0b8fb9), but that was for another unrelated issue. |
This problem don't seem to happen with the new renderer. I believe it's fixed by the new anchor mechanism which works to keep you at the same location even if the content dimensions changes while being loaded. |
I'm experiencing this same problem on Foliate 2.6.4 (RPM version), Fedora 37. The copy/pasting the CFI also works in my case. |
Right, v2.6.4 uses Epub.js, which has this problem. By the way, it probably doesn't matter anymore, since the issue is already fixed, but for the record, the theory above in my previous comment was wrong. It is true that I have since added anchoring when the page content resizes (johnfactotum/foliate-js@20254e3), but this was not true at the time I made that comment. The real reason was, I now believe, simply because the custom stylesheet is injected before it scrolls to the target page (and even before it even starts paginating). After scrolling to the target page, since the whole page is already loaded at this point, nothing will cause a resize (except for interactive elements), so the resize observer wasn't really doing anything useful. It's easy to show this, since the resize observer actually does nothing in Firefox (https://bugzilla.mozilla.org/show_bug.cgi?id=1832939). But the renderer works perfectly in Firefox anyway, as long as you don't trigger resizes by e.g. loading a non-local resource such as fonts. |
Thanks for the update and explanation - do you know when the new renderer will be coming to the version of Foliate in the Fedora repositories? And is it already implemented in the Flatpak? (I'd prefer to use the repo version as that makes it marginally easier to sync the Foliate system files between devices via Syncthing) |
The new renderer is used in the gtk4 branch. It's not released yet. |
Describe the bug
Reading an ebook of 2073 pages, after reading over the 1265 page (example, until page 1310) and closing foliate, when opening again, it will display page 1265. If i close the book at a page minor of 1265 everything is ok.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Foliate open the book to correct page (in the example, page 1310)
Actual behavior
Foliate keep opening at page 1265
Version:
Additional context
Problem doesn't seem related to saving the last position correctly: if I go to library instead of closing foliate, I can see that the book's percentage of reading is correct. But if I reopen it it will be opened at the same, wrong, page.
The text was updated successfully, but these errors were encountered: