Bug 1441218 - Remove componentWillMount() from the font inspector r=nchevobbe
authorMichael Ratcliffe <mratcliffe@mozilla.com>
Mon, 26 Feb 2018 17:15:36 +0000
changeset 405705 c518398e5fd10943d41ac660ba05c978d52edfd1
parent 405704 7ce5b596279883bb34d36a48b6dcd95cb51c7318
child 405706 283b2a4cb2196dde012ee0cfdc9b6577d2333a11
push id33530
push usercsabou@mozilla.com
push dateWed, 28 Feb 2018 21:47:36 +0000
treeherdermozilla-central@b3c95e78fd75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnchevobbe
bugs1441218, 1441147
milestone60.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1441218 - Remove componentWillMount() from the font inspector r=nchevobbe Turns out that this is a redux issue that was fixed by the redux update (1441147). Of course, it is bad practice to manipulate state from a non-react component but if there is no warning we can let it go. MozReview-Commit-ID: 9Ssus7ypvm2
devtools/client/inspector/fonts/fonts.js
--- a/devtools/client/inspector/fonts/fonts.js
+++ b/devtools/client/inspector/fonts/fonts.js
@@ -33,21 +33,16 @@ class FontInspector {
 
     this.onNewNode = this.onNewNode.bind(this);
     this.onPreviewFonts = this.onPreviewFonts.bind(this);
     this.onThemeChanged = this.onThemeChanged.bind(this);
 
     this.init();
   }
 
-  componentWillMount() {
-    this.store.dispatch(updatePreviewText(""));
-    this.update(false, "");
-  }
-
   init() {
     if (!this.inspector) {
       return;
     }
 
     let fontsApp = FontsApp({
       onPreviewFonts: this.onPreviewFonts,
     });
@@ -62,16 +57,19 @@ class FontInspector {
     // Expose the provider to let inspector.js use it in setupSidebar.
     this.provider = provider;
 
     this.inspector.selection.on("new-node-front", this.onNewNode);
     this.inspector.sidebar.on("fontinspector-selected", this.onNewNode);
 
     // Listen for theme changes as the color of the previews depend on the theme
     gDevTools.on("theme-switched", this.onThemeChanged);
+
+    this.store.dispatch(updatePreviewText(""));
+    this.update(false, "");
   }
 
   /**
    * Given all fonts on the page, and given the fonts used in given node, return all fonts
    * not from the page not used in this node.
    *
    * @param  {Array} allFonts
    *         All fonts used on the entire page