firebase / firebase/firebase-js-sdk

Avoid setTimeout in Firestore

Open
#1,434 5 comments 1 reaction 0 assignees View on GitHub
api: firestore enhancement feature request
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

I've created this issue based on an internal bit of feedback:

> Firestore reads are much slower when the tab is not focused.
>
> When the browser tab is not focused, Firestore reads always take over a second. This is likely because a setTimeout is being used in the code and when a tab is unfocused setTimeouts always take 1 second or more to complete, even if they are requested to be milliseconds long.
>
> You should consider using Promise.resolve().then(theDelayedFunction) instead of setTimeout(theDelayedFunction) to allow queuing all operations in a single tick. This will accomplish the same thing without the throttle the browser adds to setTimeouts.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.