Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disposing terminal after calling fit() leads to TypeError #4983

Closed
Tomtec331 opened this issue Mar 5, 2024 · 1 comment · Fixed by #4984
Closed

Disposing terminal after calling fit() leads to TypeError #4983

Tomtec331 opened this issue Mar 5, 2024 · 1 comment · Fixed by #4984
Assignees
Milestone

Comments

@Tomtec331
Copy link

Disposing a terminal directly after calling 'fit' leads to an error:

Screenshot 2024-03-05 172233

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();
@tisilent
Copy link
Contributor

tisilent commented Mar 6, 2024

reproduce .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants