From 1c41c3dd63e4fcb476ff09609e218b8511535d1c Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 5 Apr 2019 09:40:21 -0600 Subject: [PATCH] Only update analytics when there's a change Also, the arguments are the previous state, not the new state. --- src/components/structures/LeftPanel.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/structures/LeftPanel.js b/src/components/structures/LeftPanel.js index ccac053776..21c41125a4 100644 --- a/src/components/structures/LeftPanel.js +++ b/src/components/structures/LeftPanel.js @@ -86,8 +86,10 @@ const LeftPanel = React.createClass({ return false; }, - componentDidUpdate(newProps, newState) { - Analytics.setBreadcrumbs(newState.breadcrumbs); + componentDidUpdate(prevProps, prevState) { + if (prevState.breadcrumbs !== this.state.breadcrumbs) { + Analytics.setBreadcrumbs(this.state.breadcrumbs); + } }, _onBreadcrumbsChanged: function(settingName, roomId, level, valueAtLevel, value) {