UNPKG

@theia/core

Version:

Theia is a cloud & desktop IDE framework implemented in TypeScript.

31 lines • 1.14 kB
import { __decorate, __param } from "tslib"; import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime"; import { injectable, inject } from 'inversify'; import { Disposable } from '../../common/index.js'; import { AbstractDialog, DialogProps } from '../dialogs.js'; import { createRoot } from 'react-dom/client'; let ReactDialog = class ReactDialog extends AbstractDialog { constructor(props) { super(props); this.contentNodeRoot = createRoot(this.contentNode); this.isMounted = true; this.toDispose.push(Disposable.create(() => { this.contentNodeRoot.unmount(); this.isMounted = false; })); } onUpdateRequest(msg) { super.onUpdateRequest(msg); if (!this.isMounted) { this.contentNodeRoot = createRoot(this.contentNode); this.isMounted = true; } this.contentNodeRoot?.render(_jsx(_Fragment, { children: this.render() })); } }; ReactDialog = __decorate([ injectable(), __param(0, inject(DialogProps)) ], ReactDialog); export { ReactDialog }; //# sourceMappingURL=react-dialog.js.map