From 567e5b662c9bb4947cefeda6bf7784e9b26d882b Mon Sep 17 00:00:00 2001 From: Red Adaya Date: Mon, 15 Apr 2024 19:52:09 +0800 Subject: [PATCH] reload terminal when styel block is unmounted and mounted --- src/app/common/elements/termstyleblock.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/app/common/elements/termstyleblock.tsx b/src/app/common/elements/termstyleblock.tsx index 3c7ffeee1..2f7c73fd3 100644 --- a/src/app/common/elements/termstyleblock.tsx +++ b/src/app/common/elements/termstyleblock.tsx @@ -35,10 +35,20 @@ class TermStyleBlock extends React.Component<{ themeName: string; selector: string; }> { - componentDidUpdate(): void { + componentDidMount() { GlobalModel.bumpTermRenderVersion(); } + componentWillUnmount() { + GlobalModel.bumpTermRenderVersion(); + } + + componentDidUpdate(prevProps) { + if (prevProps.themeName !== this.props.themeName || prevProps.selector !== this.props.selector) { + GlobalModel.bumpTermRenderVersion(); + } + } + isValidCSSColor(color) { const element = document.createElement("div"); element.style.color = color;