Skip to content

Commit

Permalink
Deploying to gh-pages from @ 4798edf 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
facebook-github-bot committed Jan 4, 2025
1 parent 3ae3c37 commit 3e85091
Show file tree
Hide file tree
Showing 849 changed files with 4,226 additions and 4,187 deletions.
10 changes: 5 additions & 5 deletions 404.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
id: use-prefetchable-forward-pagination-fragment
title: usePrefetchableForwardPaginationFragment
slug: /api-reference/use-prefetchable-forward-pagination-fragment/
description: API reference for usePrefetchableForwardPaginationFragment_EXPERIMENTAL, an experimental React hook used to paginate a connection and automatically prefetches
description: API reference for usePrefetchableForwardPaginationFragment, an experimental React hook used to paginate a connection and automatically prefetches
keywords:
- pagination
- connection
Expand All @@ -12,14 +12,14 @@ keywords:
import DocsRating from '@site/src/core/DocsRating';

NOTE: This is an experimental API and may be subject to change.
`usePrefetchableForwardPaginationFragment_EXPERIMENTAL` is similar to [`usePaginationFragment`](../use-pagination-fragment). It adds the capability to automatically prefetch a `bufferSize` number of items to fill the buffer without displaying the items. And when `loadNext` is called, it vends from the buffer first to achieve faster pagination. It only supports forward pagination (provides APIs for `loadNext`, `hasNext` and `isLoadingNext`) for now.
`usePrefetchableForwardPaginationFragment` is similar to [`usePaginationFragment`](../use-pagination-fragment). It adds the capability to automatically prefetch a `bufferSize` number of items to fill the buffer without displaying the items. And when `loadNext` is called, it vends from the buffer first to achieve faster pagination. It only supports forward pagination (provides APIs for `loadNext`, `hasNext` and `isLoadingNext`) for now.

```js
import type {FriendsList_user$key} from 'FriendsList_user.graphql';

const React = require('React');

const {graphql, usePrefetchableForwardPaginationFragment_EXPERIMENTAL} = require('react-relay');
const {graphql, usePrefetchableForwardPaginationFragment} = require('react-relay');

type Props = {
user: FriendsList_user$key,
Expand All @@ -33,7 +33,7 @@ function FriendsList(props: Props) {
hasNext,
isLoadingNext,
refetch, // For refetching connection
} = usePrefetchableForwardPaginationFragment_EXPERIMENTAL(
} = usePrefetchableForwardPaginationFragment(
graphql`
fragment FriendsListComponent_user on User
@refetchable(queryName: "FriendsListPaginationQuery") {
Expand Down
39 changes: 39 additions & 0 deletions _src/guides/relay-resolvers/defining-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,42 @@ This is just a simple resolver that reads from the model type and returns a scal
* [Field Arguments](./field-arguments.md)
* [Live Fields](./live-fields.md)
* [Derived Fields](./derived-fields.md)

<FbInternalOnly>

## Simplified Syntax for Property Lookups

If you have a ["weak" type](./defining-types.md#defining-a-weak-type), you can easily define a simple resolver that just returns a property from the underlying model. For example, take a resolver being defined on the `UserModel` that looks like:
```tsx
/**
* @RelayResolver
*/
export function name(user: UserModel): string {
return user.name;
}
```

When defining the weak type, this resolver can by automatically generated by using a docblock with `@gqlField` over the field you want to expose.
```tsx
/**
* @RelayResolver
*/
export type UserModel = {
/**
* @gqlField
*/
name: string,
}
```
You can optionally include a description or `@deprecated` tag in the docblock
```tsx
/**
* @gqlField
* @deprecated Do not use this field anymore
*
* This is a description. Include more information
* about your field here.
*/
```
</FbInternalOnly>
1 change: 1 addition & 0 deletions assets/js/203e1026.43a98ffc.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3e85091

Please sign in to comment.