mirror of
https://github.com/coder/coder.git
synced 2026-09-22 05:05:20 +08:00
Prevent terminal being created twice (#10200)
I missed this in code review.
This commit is contained in:
@@ -154,7 +154,7 @@ const TerminalPage: FC = () => {
|
||||
|
||||
// Create the terminal!
|
||||
useEffect(() => {
|
||||
if (!xtermRef.current) {
|
||||
if (!xtermRef.current || config.isLoading) {
|
||||
return;
|
||||
}
|
||||
const terminal = new XTerm.Terminal({
|
||||
@@ -210,7 +210,7 @@ const TerminalPage: FC = () => {
|
||||
window.removeEventListener("resize", listener);
|
||||
terminal.dispose();
|
||||
};
|
||||
}, [config.data, sendEvent, xtermRef, handleWebLink]);
|
||||
}, [config.data, config.isLoading, sendEvent, xtermRef, handleWebLink]);
|
||||
|
||||
// Triggers the initial terminal connection using
|
||||
// the reconnection token and workspace name found
|
||||
|
||||
Reference in New Issue
Block a user