From af974db0985aefe412b3cdb4801ef23d7d1a12bd Mon Sep 17 00:00:00 2001 From: Jared Scheib Date: Wed, 9 Aug 2017 16:03:31 -0700 Subject: [PATCH] Refactor setDefaultLabels for clarity --- ui/src/dashboards/components/DisplayOptions.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/ui/src/dashboards/components/DisplayOptions.js b/ui/src/dashboards/components/DisplayOptions.js index 0a09db7e61..edbd71d1fc 100644 --- a/ui/src/dashboards/components/DisplayOptions.js +++ b/ui/src/dashboards/components/DisplayOptions.js @@ -23,13 +23,12 @@ class DisplayOptions extends Component { } setDefaultLabels(axes, queryConfigs) { - if (!queryConfigs.length) { - return axes - } - - const defaultYLabel = buildDefaultYLabel(queryConfigs[0]) - - return {...axes, y: {...axes.y, defaultYLabel}} + return queryConfigs.length + ? { + ...axes, + y: {...axes.y, defaultYLabel: buildDefaultYLabel(queryConfigs[0])}, + } + : axes } render() {