Skip to content

Commit a38737b

Browse files
committed
Ignore other config changes
The terminal only cares about the renderer specifically, no need to recreate the terminal if something else changes.
1 parent 81a7e57 commit a38737b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

site/src/pages/TerminalPage/TerminalPage.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ const TerminalPage: FC = () => {
8484
}, [lifecycleState]);
8585

8686
const config = useQuery(deploymentConfig());
87+
const renderer = config.data?.config.web_terminal_renderer;
8788

8889
// handleWebLink handles opening of URLs in the terminal!
8990
const handleWebLink = useCallback(
@@ -150,9 +151,9 @@ const TerminalPage: FC = () => {
150151
background: colors.gray[16],
151152
},
152153
});
153-
if (config.data?.config.web_terminal_renderer === "webgl") {
154+
if (renderer === "webgl") {
154155
terminal.loadAddon(new WebglAddon());
155-
} else if (config.data?.config.web_terminal_renderer === "canvas") {
156+
} else if (renderer === "canvas") {
156157
terminal.loadAddon(new CanvasAddon());
157158
}
158159
const fitAddon = new FitAddon();
@@ -176,7 +177,7 @@ const TerminalPage: FC = () => {
176177
window.removeEventListener("resize", listener);
177178
terminal.dispose();
178179
};
179-
}, [config.data, config.isLoading, xtermRef, handleWebLink]);
180+
}, [renderer, config.isLoading, xtermRef, handleWebLink]);
180181

181182
// Updates the reconnection token into the URL if necessary.
182183
useEffect(() => {

0 commit comments

Comments
 (0)