-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Disposing terminal after calling fit() leads to TypeError #4983
Copy link
Copy link
Closed
Milestone
Description
Disposing a terminal directly after calling 'fit' leads to an error:
Background: We are using xterm with react in strict mode. This means that the terminal will be mounted and directly unmounted afterwards. The code shown below is a minimal reproduction of what actually happens (without react lifecycle hooks).
Details
- Browser and browser version: Firefox 123.0
- OS version: Windows 11 23H2
- xterm.js version: 5.4.0 / addon-fit: 0.9.0
Steps to reproduce
Minimal code to reproduce:
import { Terminal } from '@xterm/xterm';
import { FitAddon } from '@xterm/addon-fit';
import '@xterm/xterm/css/xterm.css';
const div = document.querySelector<HTMLDivElement>('#app')!;
const terminal = new Terminal();
const addon = new FitAddon();
// component mounts
terminal.open(div);
terminal.loadAddon(addon);
addon.fit();
// component unmounts
terminal.dispose();Reactions are currently unavailable
