Update dataloader.rst

This commit is contained in:
Justin Miller 2021-04-12 22:48:53 -07:00 committed by GitHub
parent a5fbb2e9e5
commit 3ed8273239
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,10 +28,9 @@ Create loaders by providing a batch loading function.
A batch loading function accepts a list of keys, and returns a ``Promise`` A batch loading function accepts a list of keys, and returns a ``Promise``
which resolves to a list of ``values``. which resolves to a list of ``values``.
Then load individual values from the loader. ``DataLoader`` will coalesce all ``DataLoader`` will coalesce all individual loads which occur within a
individual loads which occur within a single frame of execution (executed once single frame of execution (executed once the wrapping promise is resolved)
the wrapping promise is resolved) and then call your batch function with all and then call your batch function with all requested keys.
requested keys.
.. code:: python .. code:: python
@ -96,7 +95,7 @@ Consider the following GraphQL request:
} }
Naively, if ``me``, ``bestFriend`` and ``friends`` each need to request the backend, If ``me``, ``bestFriend`` and ``friends`` each need to send a request to the backend,
there could be at most 13 database requests! there could be at most 13 database requests!