aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPéter Gömöri <[email protected]>2015-02-08 00:11:18 +0100
committerPéter Gömöri <[email protected]>2015-06-02 16:02:34 +0200
commit93ba3a78f92c7e19997bd057e9ce1cdb4acd7b62 (patch)
treea001693df961f775fec414cefc457b011e0cd8f8
parent65bf43e82a8ec731aafdbac74d41d65b63c7f49c (diff)
downloadotp-93ba3a78f92c7e19997bd057e9ce1cdb4acd7b62.tar.gz
otp-93ba3a78f92c7e19997bd057e9ce1cdb4acd7b62.tar.bz2
otp-93ba3a78f92c7e19997bd057e9ce1cdb4acd7b62.zip
Don't refresh observer table view if there was no change
Avoid refreshing the list of tables every refresh interval (by default 10 secs) if the content did not change. Because of the refresh the list was scrolled to the begining and current selection was lost which could be quite anoying.
-rw-r--r--lib/observer/src/observer_tv_wx.erl14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/observer/src/observer_tv_wx.erl b/lib/observer/src/observer_tv_wx.erl
index da4cb8e041..acfa6a2a99 100644
--- a/lib/observer/src/observer_tv_wx.erl
+++ b/lib/observer/src/observer_tv_wx.erl
@@ -176,10 +176,16 @@ handle_call(Event, From, _State) ->
handle_cast(Event, _State) ->
error({unhandled_cast, Event}).
-handle_info(refresh_interval, State = #state{node=Node, grid=Grid, opt=Opt}) ->
- Tables = get_tables(Node, Opt),
- Tabs = update_grid(Grid, Opt, Tables),
- {noreply, State#state{tabs=Tabs}};
+handle_info(refresh_interval, State = #state{node=Node, grid=Grid, opt=Opt,
+ tabs=OldTabs}) ->
+ case get_tables(Node, Opt) of
+ OldTabs ->
+ %% no change
+ {noreply, State};
+ Tables ->
+ Tabs = update_grid(Grid, Opt, Tables),
+ {noreply, State#state{tabs=Tabs}}
+ end;
handle_info({active, Node}, State = #state{parent=Parent, grid=Grid, opt=Opt,
timer=Timer0}) ->