Skip to content

Commit

Permalink
fix: singleton will throw an additional error
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiteMinds committed Mar 10, 2024
1 parent e8354c1 commit 87cd0d7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/web/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ export function singleton<Fn extends (...args: any) => Promise<any>>(fn: Fn): Fn
return function (this: unknown, ...args) {
if (latestPromise) return latestPromise

const promise = fn.apply(this, args)
promise.finally(() => {
const promise = fn.apply(this, args).finally(() => {
if (promise === latestPromise) {
latestPromise = null
}
Expand Down

0 comments on commit 87cd0d7

Please sign in to comment.