Commit c1d1fec5 authored by Laurent Wouters's avatar Laurent Wouters
Browse files

[fix] Try to only refresh when necessary

parent a7fd455964c2
......@@ -410,6 +410,19 @@ class LDBrowserImpl implements LDBrowser {
*/
public setCommand(command: ResourceUserCommand): void {
if (this.currentResource == null) return;
let mustRefresh = false;
if (this.currentResource.command.selectedTopic != command.selectedTopic)
mustRefresh = true;
if (this.currentResource.command.selectedSource != command.selectedSource)
mustRefresh = true;
if (this.currentResource.command.selectedView != command.selectedView)
mustRefresh = true;
if (
this.currentResource.command.selectedLanguage.iso639_2 !=
command.selectedLanguage.iso639_2
)
mustRefresh = true;
this.currentResource.command = command;
if (mustRefresh) this.refresh();
}
}
......@@ -58,7 +58,6 @@ chrome.runtime.onMessage.addListener(function(
sendResponse(CURRENT_BROWSER.getCurrentResource());
} else if (request.requestType == "UpdateCurrentCommand") {
CURRENT_BROWSER.setCommand(request.payload);
CURRENT_BROWSER.refresh();
}
});
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment