Skip to content

Commit 93ed398

Browse files
authored
Merge pull request #7977 from sagemathinc/fix-react-20241022
frontend/flyout/terminal: get rid of deprecated ReactDOM.findDOMNode
2 parents 493e6cd + c8001c0 commit 93ed398

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/packages/frontend/project/page/flyouts/files-terminal.tsx

+7-10
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { debounce } from "lodash";
88

99
import {
1010
CSS,
11-
ReactDOM,
1211
redux,
1312
useActions,
1413
useEffect,
@@ -61,7 +60,7 @@ export function TerminalFlyout({
6160
const account_id = useTypedRedux("account", "account_id");
6261
const terminal = useTypedRedux("account", "terminal");
6362
const terminalRef = useRef<Terminal | undefined>(undefined);
64-
const terminalDOMRef = useRef<any>(null);
63+
const terminalDOMRef = useRef<HTMLDivElement>(null);
6564
const isMountedRef = useIsMountedRef();
6665
const student_project_functionality =
6766
useStudentProjectFunctionality(project_id);
@@ -89,13 +88,11 @@ export function TerminalFlyout({
8988
const id = `flyout::${hash}`; // TODO what exactly is the ID? arbitrary or a path?
9089
useEffect(() => {
9190
if (compute_server_id) {
92-
redux
93-
.getProjectActions(project_id)
94-
.setComputeServerIdForFile({
95-
path: terminal_path,
96-
compute_server_id,
97-
confirm: false,
98-
});
91+
redux.getProjectActions(project_id).setComputeServerIdForFile({
92+
path: terminal_path,
93+
compute_server_id,
94+
confirm: false,
95+
});
9996
}
10097
}, [terminal_path]);
10198

@@ -189,7 +186,7 @@ export function TerminalFlyout({
189186

190187
function init_terminal(): void {
191188
if (!is_visible) return;
192-
const node: any = ReactDOM.findDOMNode(terminalDOMRef.current);
189+
const node = terminalDOMRef.current;
193190
if (node == null) {
194191
// happens, e.g., when terminals are disabled.
195192
return;

0 commit comments

Comments
 (0)