add checking for latestversion (avoid potential error in semver.compareLoose)

This commit is contained in:
sawka 2023-12-16 11:36:38 -08:00
parent ad225ed28a
commit 781ebe8154

View File

@ -197,6 +197,10 @@ class MainSideBar extends React.Component<{}, {}> {
let isCollapsed = this.collapsed.get(); let isCollapsed = this.collapsed.get();
let mainView = GlobalModel.activeMainView.get(); let mainView = GlobalModel.activeMainView.get();
let clientData = GlobalModel.clientData.get(); let clientData = GlobalModel.clientData.get();
let needsUpdate = false;
if (!clientData?.clientopts.noreleasecheck && !isBlank(clientData?.releaseinfo?.latestversion)) {
needsUpdate = compareLoose(VERSION, clientData.releaseinfo.latestversion) < 0;
}
return ( return (
<div className={cn("main-sidebar", { collapsed: isCollapsed }, { "is-dev": GlobalModel.isDev })}> <div className={cn("main-sidebar", { collapsed: isCollapsed }, { "is-dev": GlobalModel.isDev })}>
<div className="title-bar-drag" /> <div className="title-bar-drag" />
@ -244,7 +248,7 @@ class MainSideBar extends React.Component<{}, {}> {
</div> </div>
<div className="middle hideScrollbarUntillHover">{this.getSessions()}</div> <div className="middle hideScrollbarUntillHover">{this.getSessions()}</div>
<div className="bottom"> <div className="bottom">
<If condition = {!clientData?.clientopts.noreleasecheck && clientData?.releaseinfo && compareLoose(VERSION, clientData.releaseinfo.latestversion) < 0} > <If condition={needsUpdate}>
<div <div
className="item hoverEffect unselectable updateBanner" className="item hoverEffect unselectable updateBanner"
onClick={() => openLink("https://www.waveterm.dev/download")} onClick={() => openLink("https://www.waveterm.dev/download")}