From 315296458a1058c44110625b0c6858bfa24c9feb Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Mon, 9 Sep 2024 23:39:29 -0400 Subject: [PATCH] Remove setting button styles in `componentDidMount` Just set the state, and the renderer will know what to display. --- shared/naturalcrit/splitPane/splitPane.jsx | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/shared/naturalcrit/splitPane/splitPane.jsx b/shared/naturalcrit/splitPane/splitPane.jsx index 665fe416b..d917da3bb 100644 --- a/shared/naturalcrit/splitPane/splitPane.jsx +++ b/shared/naturalcrit/splitPane/splitPane.jsx @@ -44,21 +44,9 @@ const SplitPane = createClass({ } window.addEventListener('resize', this.handleWindowResize); - // This lives here instead of in the initial render because you cannot touch localStorage until the componant mounts. const loadLiveScroll = window.localStorage.getItem('liveScroll') === 'true'; - this.setState({ - liveScroll : loadLiveScroll - }); - const toggle = document.getElementById('scrollToggle'); - const toggleDiv = document.getElementById('scrollToggleDiv'); - if(loadLiveScroll) { - toggle.className = 'fas fa-lock'; - toggleDiv.className = 'arrow lock'; - } else { - toggle.className = 'fas fa-unlock'; - toggleDiv.className = 'arrow unlock'; - } + this.setState({ liveScroll : loadLiveScroll }); }, componentWillUnmount : function() {