Skip to content

Commit

Permalink
batch nav updates (#3159)
Browse files Browse the repository at this point in the history
  • Loading branch information
Evelyn-H authored Oct 25, 2024
1 parent 76aa56b commit 35bb79b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions router/src/components/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,15 @@ impl RouterContextInner {

let resolved = resolved_to.to_string();
let state = options.state.clone();
set_reference.update(move |r| *r = resolved);

set_state.update({
let next_state = state.clone();
move |state| *state = next_state
// batch these so the history update is atomic
batch(|| {
set_reference.update(move |r| *r = resolved);

set_state.update({
let next_state = state.clone();
move |state| *state = next_state
});
});

let global_suspense =
Expand Down

0 comments on commit 35bb79b

Please sign in to comment.