-
Notifications
You must be signed in to change notification settings - Fork 439
Expand file tree
/
Copy pathpage.tsx
More file actions
46 lines (41 loc) · 1.24 KB
/
Copy pathpage.tsx
File metadata and controls
46 lines (41 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { graphql } from "relay-runtime";
import fetchQuery from "src/relay/fetchQuery";
import styles from "styles/MainView.module.css";
import { pageMainViewQuery } from "__generated__/pageMainViewQuery.graphql";
import RelayRoot from "src/relay/RelayRoot";
import Issues from "src/components/Issues";
import { environment } from "src/relay/environment";
// This is a server only component. FetchQuery is never executed on the client
// we're passing serializable fragment key (+ we include extra information about fetched queries)
// so we can process them on the client (add client components can also
const Page = async () => {
const data = await fetchQuery<pageMainViewQuery>(
environment,
graphql`
query pageMainViewQuery($owner: String!, $name: String!) {
repository(owner: $owner, name: $name) {
owner {
login
}
name
...IssuesFragment
}
}
`,
{
owner: "facebook",
name: "relay",
}
);
return (
<div className={styles.main}>
<h1>
{data.repository?.owner.login}/{data.repository?.name}
</h1>
<RelayRoot>
<Issues issues={data.repository ?? null} />
</RelayRoot>
</div>
);
};
export default Page;