Skip to content

Commit d739a4b

Browse files
irevoireemilk
authored andcommitted
Request a redraw when the url change through the popstate event listener (#7403)
<!-- Please read the "Making a PR" section of [`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/CONTRIBUTING.md) before opening a Pull Request! * Keep your PR:s small and focused. * The PR title is what ends up in the changelog, so make it descriptive! * If applicable, add a screenshot or gif. * If it is a non-trivial addition, consider adding a demo for it to `egui_demo_lib`, or a new example. * Do NOT open PR:s from your `master` branch, as that makes it hard for maintainers to test and add commits to your PR. * Remember to run `cargo fmt` and `cargo clippy`. * Open the PR as a draft until you have self-reviewed it and run `./scripts/check.sh`. * When you have addressed a PR comment, mark it as resolved. Please be patient! I will review your PR, but my time is limited! --> Hey, I added an event listener on the [`popstate` event](https://developer.mozilla.org/en-US/docs/Web/API/Window/popstate_event). That fixed my issue https://github.com/user-attachments/assets/a621dac9-b7c3-426a-968b-dc73c5702eea * Closes #7402 * [x] I have followed the instructions in the PR template
1 parent b732992 commit d739a4b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

crates/eframe/src/web/events.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ fn install_window_events(runner_ref: &WebRunner, window: &EventTarget) -> Result
405405

406406
// No need to subscribe to "resize": we already subscribe to the canvas
407407
// size using a ResizeObserver, and we also subscribe to DPR changes of the monitor.
408-
for event_name in &["load", "pagehide", "pageshow"] {
408+
for event_name in &["load", "pagehide", "pageshow", "popstate"] {
409409
runner_ref.add_event_listener(window, event_name, move |_: web_sys::Event, runner| {
410410
if DEBUG_RESIZE {
411411
log::debug!("{event_name:?}");

0 commit comments

Comments
 (0)