Skip to content

Commit

Permalink
PKG -- [fcl] Retry on network error is page is not visible during bac…
Browse files Browse the repository at this point in the history
…kchannel polling
  • Loading branch information
JeffreyDoyle committed Apr 12, 2023
1 parent 84f2dd7 commit 4090b3e
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ export async function poll(service, canContinue = () => true) {
} catch (error) {
if (
typeof document !== "undefined" &&
document.visibilityState === "visible"
document.visibilityState === "hidden"
) {
await new Promise(r => setTimeout(r, 500))
return poll(resp.updates, canContinue)
return poll(service, canContinue)
} else {
throw error
}
throw error
}

switch (resp.status) {
Expand Down

0 comments on commit 4090b3e

Please sign in to comment.