facebook / facebook/relay

several errors possibly

Open
#4,531 4 comments 4 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

in https://relay.dev/docs/tutorial/connections-pagination/#improving-the-loading-experience-with-usetransition
there is no CommentsLoadingSpinner
I had to use SmallSpinner

but even so, the spinner is flashing for a split second and is gone (like 0.01s). For this one, I am not sure if it is some mistake I made or is it your code.

And then at https://relay.dev/docs/tutorial/connections-pagination/#step-5--call-usepaginationfragment

why is the function Newsfeed() all of a sudden becomes

NewsfeedContents({viewer}) {

and why adding `{viewer}` when down below in Step 6 it is immediately `{query}`

also the line

const {data, loadNext} = usePaginationFragment(NewsfeedFragment, viewer);

the NewsfeedFragment should be NewsfeedContentsFragment

And then in Step 6, what is the `{query}`?

as in `function NewsfeedContents({query}) {`
there is no query passed in.

I had to change the code to the following to work:

```tsx
export default function Newsfeed() {

const queryData = useLazyLoadQuery(NewsfeedQuery, {});

const { data, loadNext, hasNext, isLoadingNext } = usePaginationFragment(
NewsfeedContentsFragment,
queryData
);

function onEndReached() {
loadNext(3);
}

const storyEdges = data.viewer.newsfeedStories.edges;
```

Then the page works, but the `viewer` in ` const storyEdges = data.viewer.newsfeedStories.edges;
` is underlined red. The message is: Property 'viewer' does not exist on type 'unknown'.

Also `storyEdge` in `{storyEdges.map((storyEdge) => (` is also underlined red.
The message is: Parameter 'storyEdge' implicitly has an 'any' type.

Contributor guide

Open the contributing guide

Research direction

Start with the Connections & Pagination tutorial sections “Improving the loading experience with useTransition,” “Step 5 – Call usePaginationFragment,” and Step 6, comparing the names, props, fragments, and TypeScript examples. Done means the tutorial uses consistent component and fragment names, explains the query data flow, and provides working spinner and type-safe examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
documentation, frontend
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.