Skip to content

Commit

Permalink
Fix stale event listener when using MatTopAppBarFixed in a function c…
Browse files Browse the repository at this point in the history
…omponent (#22)
  • Loading branch information
ncpenke authored Mar 15, 2022
1 parent 1bfb89d commit 69a7e2c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions material-yew/src/top_app_bar_fixed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ impl Component for MatTopAppBarFixed {
}
}

fn changed(&mut self, _ctx: &Context<Self>) -> bool {
// clear nav_listener in case a new callback was registered
self.nav_listener = None;
true
}

fn rendered(&mut self, ctx: &Context<Self>, _first_render: bool) {
let props = ctx.props();
if self.nav_listener.is_none() {
Expand Down

0 comments on commit 69a7e2c

Please sign in to comment.