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

perf: avoid gpu memory increase #7405

Open
wants to merge 1 commit into
base: canary
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/components/term.tsx
Expand Up @@ -475,6 +475,18 @@ export default class Term extends React.PureComponent<
if (prevProps.rows !== this.props.rows || prevProps.cols !== this.props.cols) {
this.resize(this.props.cols!, this.props.rows!);
}

if (this.props.isTermActive) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
(this.term as any)._core._renderService.clear();
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
(this.term as any)._core._renderService.handleResize((this.term as any).cols, (this.term as any).rows);
} else {
this.term.element?.querySelectorAll('canvas').forEach((canvas) => {
canvas.width = canvas.height = 0;
canvas.style.width = canvas.style.height = '0px';
});
}
}

onTermWrapperRef = (component: HTMLElement | null) => {
Expand Down