Skip to content

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

@Tomtec331

Description

@Tomtec331

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();

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions