-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Reset state upon load if showPreviousViewOnLoad #5680
Reset state upon load if showPreviousViewOnLoad #5680
Conversation
I'm sorry, but given the asynchronous nature of the code involved I don't understand how we can guarantee that this will work (even if it currently does). I'm instead suggesting that we move Edit: Yes, I'm aware that this means that the pref won't be read again if a new file is opened in the viewer. However, I regard that as an edge case (given the main use-case for the default viewer), and I'm more worried about this patch causing unnecessary and easily preventable regressions in the future. |
If you worry about race conditions, what about: showPreviousViewOnLoadPromise.then(function() {
PDFHistory.initialize(self.documentFingerprint, self);
}); |
That would introduce a completely unnecessary dependency between the history and the preferences. |
e0c90f8
to
1bead89
Compare
@Snuffleupagus Done. I guess that by the same reasoning, we should move I've noticed that we're using |
Seems fine, but please also add
Yes, I think that would be best.
It's fairly common in the PDF.js codebase to use |
1bead89
to
3f96ff7
Compare
And moved showPreviousViewOnLoad up to PDFViewerApplication.initialize
3f96ff7
to
6a16d7d
Compare
@Snuffleupagus Done. Moving the other parameter can be done in a separate commit. |
Reset state upon load if showPreviousViewOnLoad
Thanks for the patch! |
…Load Reset state upon load if showPreviousViewOnLoad
Fixes #5648