Skip to content

Avoid setTimeout in Firestore #1434

@wilhuff

Description

@wilhuff

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions