Skip to content

Commit fe1b315

Browse files
Fix serial re-init required when switching tabs (#1163)
This moves the ref for the parent container into the useEffect call instead of copying it outside of the useEffect.
1 parent 6844eba commit fe1b315

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/serial/XTerm.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ const useManagedTermimal = (
4747
tabOutRef: HTMLElement,
4848
fontSizePt: number
4949
): void => {
50-
const parent = ref.current;
5150
const actionFeedback = useActionFeedback();
5251
const codeFontFamily = useToken("fonts", "code");
5352
const device = useDevice();
@@ -58,6 +57,7 @@ const useManagedTermimal = (
5857
const initialFontSizeRef = useRef<number>(fontSizePt);
5958

6059
useEffect(() => {
60+
const parent = ref.current;
6161
if (!parent) {
6262
return;
6363
}
@@ -188,11 +188,11 @@ const useManagedTermimal = (
188188
currentTerminalRef,
189189
device,
190190
isUnmounted,
191-
parent,
192191
setSelection,
193192
fitAddon,
194193
initialFontSizeRef,
195194
tabOutRef,
195+
ref,
196196
]);
197197

198198
useEffect(() => {

0 commit comments

Comments
 (0)