Bug 1404138 - Properly dispatch actions; r=nchevobbe draft
authorJan Odvarko <odvarko@gmail.com>
Tue, 03 Oct 2017 12:42:04 +0200
changeset 674186 7e4de60a9b95314db59c571600931b64ea78412a
parent 673165 44643fce30b43a8981535c335aaccb45006e456b
child 734248 7be0fd7535e3605059a85077515df6727cf50ba9
push id82747
push userjodvarko@mozilla.com
push dateTue, 03 Oct 2017 10:42:38 +0000
reviewersnchevobbe
bugs1404138
milestone58.0a1
Bug 1404138 - Properly dispatch actions; r=nchevobbe MozReview-Commit-ID: 2jMTXUzAvAh
devtools/client/webconsole/new-console-output/new-console-output-wrapper.js
--- a/devtools/client/webconsole/new-console-output/new-console-output-wrapper.js
+++ b/devtools/client/webconsole/new-console-output/new-console-output-wrapper.js
@@ -261,34 +261,35 @@ NewConsoleOutputWrapper.prototype = {
     this.throttledDispatchTimeout = setTimeout(() => {
       this.throttledDispatchTimeout = null;
 
       store.dispatch(actions.messagesAdd(this.queuedMessageAdds));
       this.queuedMessageAdds = [];
 
       if (this.queuedMessageUpdates.length > 0) {
         this.queuedMessageUpdates.forEach(({ message, res }) => {
-          actions.networkMessageUpdate(message);
+          store.dispatch(actions.networkMessageUpdate(message));
           this.jsterm.hud.emit("network-message-updated", res);
         });
         this.queuedMessageUpdates = [];
       }
       if (this.queuedRequestUpdates.length > 0) {
         this.queuedRequestUpdates.forEach(({ id, data}) => {
-          actions.networkUpdateRequest(id, data);
-          // Fire an event indicating that all data fetched from
-          // the backend has been received. This is based on
-          // 'FirefoxDataProvider.isQueuePayloadReady', see more
-          // comments in that method.
-          // (netmonitor/src/connector/firefox-data-provider).
-          // This event might be utilized in tests to find the right
-          // time when to finish.
-          this.jsterm.hud.emit("network-request-payload-ready", {id, data});
+          store.dispatch(actions.networkUpdateRequest(id, data));
         });
         this.queuedRequestUpdates = [];
+
+        // Fire an event indicating that all data fetched from
+        // the backend has been received. This is based on
+        // 'FirefoxDataProvider.isQueuePayloadReady', see more
+        // comments in that method.
+        // (netmonitor/src/connector/firefox-data-provider).
+        // This event might be utilized in tests to find the right
+        // time when to finish.
+        this.jsterm.hud.emit("network-request-payload-ready");
       }
     }, 50);
   },
 
   // Should be used for test purpose only.
   getStore: function () {
     return store;
   }