Skip to content

Commit

Permalink
Rerun relay compiler (#4288)
Browse files Browse the repository at this point in the history
Summary:
The project comes with precompiled relay fragments that do not work when the student who is just starting this tutorial tries to fetch the top query without having any fragments defined. To make it work, we need to delete the precompiled queries and re compile. The student also does not know the command to do that since it is not mentioned anywhere and they may not know to look for it in the `package.json` file. These specifics are important to unblock the student at this stage.

Pull Request resolved: #4288

Reviewed By: voideanvalue

Differential Revision: D46361100

Pulled By: captbaritone

fbshipit-source-id: 3a6775002366ece555e54f605507e88d293ef471
  • Loading branch information
Anwesha-B authored and facebook-github-bot committed Jun 2, 2023
1 parent 04005db commit 97cedbc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions website/docs/tutorial/queries-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,13 @@ This illustrates the part of the graph that this query is asking for:

![Parts of the GraphQL query](/img/docs/tutorial/query-breakdown.png)

Now that we’ve defined the query, we need to modify our React component to fetch it and to use the data returned by the server.
Now that we’ve defined the query, we need to do two things.
1. Run relay compiler so that it knows aboout the new Graphql query. [npm run relay.]
2. Modify our React component to fetch it and to use the data returned by the server.

Turn back to the `Newsfeed` component and start by deleting the placeholder data. Then replace it with this:
If you open package.json you will find the script `relay` is hooked up to run the relay-compiler. This is what npm run relay does. Once the compiler successfully updates/generated the new compiled query you will be able to find it in the __generated__ folder under src/components/ as NewsfeedQuery.graphql.ts. This project comes with precomputed fragments, so unless you do this step, you will not get the desired results.

Next, Turn back to the `Newsfeed` component and start by deleting the placeholder data. Then replace it with this:

```
import { useLazyLoadQuery } from "react-relay";
Expand Down

0 comments on commit 97cedbc

Please sign in to comment.