Skip to content

Commit

Permalink
Add video tutorial about the n+1 query problem
Browse files Browse the repository at this point in the history
  • Loading branch information
fzaninotto committed Jul 3, 2024
1 parent 3140979 commit ea90855
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/ReferenceField.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ To override the style of all instances of `<ReferenceField>` using the [applicat

## Performance

<iframe src="https://www.youtube-nocookie.com/embed/egBhWqF3sWc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen style="aspect-ratio: 16 / 9;width:100%;margin-bottom:1em;"></iframe>

When used in a `<Datagrid>`, `<ReferenceField>` fetches the referenced record only once for the entire table.

![ReferenceField](./img/reference-field.png)
Expand Down
2 changes: 2 additions & 0 deletions docs/useGetOne.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ const UserProfile = () => {

## Aggregating `getOne` Calls

<iframe src="https://www.youtube-nocookie.com/embed/egBhWqF3sWc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen style="aspect-ratio: 16 / 9;width:100%;margin-bottom:1em;"></iframe>

If you use `useGetOne` several times on a page for the same resource, replace the `useGetOne` call by `useGetManyAggregate`, as it de-duplicates and aggregates queries for a single record into one batch query for many records.

```diff
Expand Down

0 comments on commit ea90855

Please sign in to comment.