Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit c6c400f

Browse files
committed
fix: UpdateChecker may call setState before mount
1 parent 9ff3371 commit c6c400f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

plugins/plugin-electron-components/src/components/UpdateChecker.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ export default class UpdateChecker extends React.PureComponent<Props, State> {
111111
public constructor(props: Props) {
112112
super(props)
113113

114-
setTimeout(() => this.checkForUpdates(), this.props.lag || DEFAULT_LAG)
115-
116114
this.state = {
117115
pinger: this.initPinger(),
118116
currentVersion: undefined,
@@ -208,8 +206,9 @@ export default class UpdateChecker extends React.PureComponent<Props, State> {
208206
}
209207
}
210208

211-
public componentDidMount() {
212-
this.getCurrentVersion()
209+
public async componentDidMount() {
210+
await this.getCurrentVersion()
211+
setTimeout(() => this.checkForUpdates(), this.props.lag || DEFAULT_LAG)
213212
}
214213

215214
/** Bye! */

0 commit comments

Comments
 (0)