From 7a5e2c248cf27badc4865ab83196e03c0da982b4 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 12 Feb 2023 23:58:50 -0800 Subject: [PATCH] Fixed: File browser (cherry picked from commit f7ce5c7b115ea0d12ab63f19960c473e09e30f3d) --- .../FileBrowser/FileBrowserModalContent.js | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/frontend/src/Components/FileBrowser/FileBrowserModalContent.js b/frontend/src/Components/FileBrowser/FileBrowserModalContent.js index 8d65dfcb0..9951ce436 100644 --- a/frontend/src/Components/FileBrowser/FileBrowserModalContent.js +++ b/frontend/src/Components/FileBrowser/FileBrowserModalContent.js @@ -1,6 +1,5 @@ import PropTypes from 'prop-types'; import React, { Component } from 'react'; -import ReactDOM from 'react-dom'; import Alert from 'Components/Alert'; import PathInput from 'Components/Form/PathInput'; import Button from 'Components/Link/Button'; @@ -39,7 +38,7 @@ class FileBrowserModalContent extends Component { constructor(props, context) { super(props, context); - this._scrollerNode = null; + this._scrollerRef = React.createRef(); this.state = { isFileBrowserModalOpen: false, @@ -57,21 +56,10 @@ class FileBrowserModalContent extends Component { currentPath !== prevState.currentPath ) { this.setState({ currentPath }); - this._scrollerNode.scrollTop = 0; + this._scrollerRef.current.scrollTop = 0; } } - // - // Control - - setScrollerRef = (ref) => { - if (ref) { - this._scrollerNode = ReactDOM.findDOMNode(ref); - } else { - this._scrollerNode = null; - } - }; - // // Listeners @@ -143,7 +131,7 @@ class FileBrowserModalContent extends Component { />