Skip to content

Commit

Permalink
Fix small dev warning about stale update after unmount if about dialo…
Browse files Browse the repository at this point in the history
…g closed
  • Loading branch information
cmdcolin committed Dec 15, 2020
1 parent d8ca43a commit fc19bb3
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,21 +253,27 @@ export default function AboutDialog({
useEffect(() => {
const aborter = new AbortController()
const { signal } = aborter
let cancelled = false
;(async () => {
try {
const adapterConfig = getConf(model, 'adapter')
const result = await rpcManager.call(sessionId, 'CoreGetInfo', {
adapterConfig,
signal,
})
setInfo(result as FileInfo)
if (!cancelled) {
setInfo(result as FileInfo)
}
} catch (e) {
setError(e)
if (!cancelled) {
setError(e)
}
}
})()

return () => {
aborter.abort()
cancelled = true
}
}, [model, rpcManager, sessionId])

Expand Down

0 comments on commit fc19bb3

Please sign in to comment.