Repository navigation
Conversation
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.
Reuse the post view dialog and WebView instead of rebuilding it each time
Fixes #164
Problem
show_post_view_dialog(src/ui/dialogs/post_view.rs) created a newDialogandWebViewon every call and destroyed them when the dialog closed. Each time a user viewed a post, WebView2 had to be initialized from scratch. That made opening a post slow, and it brought back the first-launch layout problem on every open: lines were shorter than the user's NVDA/Windows text settings called for.Change
The dialog, its
WebView, and the Boost/Favorite buttons are now built once and cached in athread_local. Each view only does the following:set_pagewith the new content.The script injection (Escape to close, link handling) stays in the
on_loadedhandler. It is registered once and runs after everyset_page, so behavior is unchanged. The dialog is no longer destroyed aftershow_modal. It lives for the life of the app, and wx tears it down with its parent frame on exit.Trade-offs
Testing
cargo clippyandcargo testpass, and CI is green on my fork.