Skip to content

Commit 13c1fce

Browse files
author
Daniel Herzog
committed
DFL-3572: Re-render the network-details view only when the opened resource is updated; Fixed pause & clear;
1 parent f71d12a commit 13c1fce

File tree

1 file changed

+29
-12
lines changed

1 file changed

+29
-12
lines changed

src/network/network_view.js

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ cls.NetworkLogView = function(id, name, container_class, html, default_handler,
1919
this._graph_tooltip_id = null;
2020
this._type_filters = null;
2121
this._last_render_speed = 0;
22+
this._last_updated_entry = "";
2223
this.needs_instant_update = false;
2324
this.required_services = ["resource-manager", "document-manager"];
2425

@@ -36,6 +37,7 @@ cls.NetworkLogView = function(id, name, container_class, html, default_handler,
3637
var min_render_delay = Math.max(MIN_RENDER_DELAY, this._last_render_speed * 2);
3738
if (timedelta < min_render_delay)
3839
{
40+
this._last_updated_entry = "";
3941
this._render_timeout = window.setTimeout(this._create_delayed_bound,
4042
min_render_delay - timedelta);
4143
return;
@@ -62,6 +64,7 @@ cls.NetworkLogView = function(id, name, container_class, html, default_handler,
6264
this._render_click_to_fetch_view(this._container);
6365
}
6466

67+
this._last_updated_entry = "";
6568
var now = Date.now();
6669
this._last_render_speed = now - started_rendering;
6770
this._rendertime = now;
@@ -165,7 +168,11 @@ cls.NetworkLogView = function(id, name, container_class, html, default_handler,
165168
if (this.selected && ctx.get_entry_from_filtered(this.selected))
166169
{
167170
if (this._overlay.is_active)
168-
this._overlay.update();
171+
{
172+
if (!this._last_updated_entry || this._last_updated_entry == this.selected)
173+
this._overlay.update();
174+
175+
}
169176
else
170177
this._overlay.show();
171178

@@ -426,7 +433,7 @@ cls.NetworkLogView = function(id, name, container_class, html, default_handler,
426433

427434
this._on_clear_log_bound = function(evt, target)
428435
{
429-
this.network_logger.clear_request_context();
436+
this.network_logger.remove_logger_request_context();
430437
this.needs_instant_update = true;
431438
}.bind(this);
432439

@@ -465,12 +472,16 @@ cls.NetworkLogView = function(id, name, container_class, html, default_handler,
465472
{
466473
if (message.key === "pause")
467474
{
468-
var is_paused = this.network_logger.is_paused;
469-
var pause = settings.network_logger.get(message.key);
470-
if (is_paused && !pause)
471-
this.network_logger.unpause();
472-
else if (!is_paused && pause)
473-
this.network_logger.pause();
475+
var ctx = this.network_logger.get_logger_context();
476+
if (ctx)
477+
{
478+
var is_paused = ctx.is_paused;
479+
var pause = settings.network_logger.get(message.key);
480+
if (is_paused && !pause)
481+
this.network_logger.unpause();
482+
else if (!is_paused && pause)
483+
this.network_logger.pause();
484+
}
474485
}
475486
else if (message.key === "network-profiler-mode")
476487
{
@@ -590,15 +601,21 @@ cls.NetworkLogView = function(id, name, container_class, html, default_handler,
590601
}
591602
}.bind(this);
592603

593-
var eh = window.event_handlers;
594-
var messages = window.messages;
595-
596604
this._on_context_removed_bound = function(message)
597605
{
598606
if (message.context_type === cls.NetworkLogger.CONTEXT_TYPE_LOGGER)
599607
this.update();
600608
}.bind(this);
601609

610+
this._on_resource_update_bound = function(message)
611+
{
612+
if (message.id)
613+
{
614+
this._last_updated_entry = message.id;
615+
}
616+
this.update();
617+
}.bind(this);
618+
602619
this._init = function(id, name, container_class, html, default_handler)
603620
{
604621
var eh = window.event_handlers;
@@ -623,7 +640,7 @@ cls.NetworkLogView = function(id, name, container_class, html, default_handler,
623640

624641
this.network_logger.addListener("context-added", this._on_context_established_bound);
625642
this.network_logger.addListener("context-removed", this._on_context_removed_bound);
626-
this.network_logger.addListener("resource-update", this.update.bind(this));
643+
this.network_logger.addListener("resource-update", this._on_resource_update_bound);
627644

628645
ActionHandlerInterface.apply(this);
629646
this._handlers = {

0 commit comments

Comments
 (0)