Skip to content

Commit d3a7230

Browse files
committed
stash demo prep changes
1 parent 6a011f2 commit d3a7230

10 files changed

+77
-32
lines changed

example-hooks/data/schema.graphql

Lines changed: 62 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,38 +36,58 @@ type Mutation {
3636
addTodo(input: AddTodoInput!): AddTodoPayload
3737
changeTodoStatus(input: ChangeTodoStatusInput!): ChangeTodoStatusPayload
3838
markAllTodos(input: MarkAllTodosInput!): MarkAllTodosPayload
39-
removeCompletedTodos(input: RemoveCompletedTodosInput!): RemoveCompletedTodosPayload
39+
removeCompletedTodos(
40+
input: RemoveCompletedTodosInput!
41+
): RemoveCompletedTodosPayload
4042
removeTodo(input: RemoveTodoInput!): RemoveTodoPayload
4143
renameTodo(input: RenameTodoInput!): RenameTodoPayload
4244
}
4345

44-
"""An object with an ID"""
46+
"""
47+
An object with an ID
48+
"""
4549
interface Node {
46-
"""The id of the object."""
50+
"""
51+
The id of the object.
52+
"""
4753
id: ID!
4854
}
4955

50-
"""Information about pagination in a connection."""
56+
"""
57+
Information about pagination in a connection.
58+
"""
5159
type PageInfo {
52-
"""When paginating forwards, are there more items?"""
60+
"""
61+
When paginating forwards, are there more items?
62+
"""
5363
hasNextPage: Boolean!
5464

55-
"""When paginating backwards, are there more items?"""
65+
"""
66+
When paginating backwards, are there more items?
67+
"""
5668
hasPreviousPage: Boolean!
5769

58-
"""When paginating backwards, the cursor to continue."""
70+
"""
71+
When paginating backwards, the cursor to continue.
72+
"""
5973
startCursor: String
6074

61-
"""When paginating forwards, the cursor to continue."""
75+
"""
76+
When paginating forwards, the cursor to continue.
77+
"""
6278
endCursor: String
6379
}
6480

6581
type Query {
6682
viewer: User
6783

68-
"""Fetches an object given its ID"""
84+
"""
85+
Fetches an object given its ID
86+
"""
6987
node(
70-
"""The ID of an object"""
88+
"""
89+
The ID of an object
90+
"""
7191
id: ID!
7292
): Node
7393
}
@@ -105,34 +125,56 @@ type RenameTodoPayload {
105125
}
106126

107127
type Todo implements Node {
108-
"""The ID of an object"""
128+
"""
129+
The ID of an object
130+
"""
109131
id: ID!
110132
text: String
111133
complete: Boolean
112134
}
113135

114-
"""A connection to a list of items."""
136+
"""
137+
A connection to a list of items.
138+
"""
115139
type TodoConnection {
116-
"""Information to aid in pagination."""
140+
"""
141+
Information to aid in pagination.
142+
"""
117143
pageInfo: PageInfo!
118144

119-
"""A list of edges."""
145+
"""
146+
A list of edges.
147+
"""
120148
edges: [TodoEdge]
121149
}
122150

123-
"""An edge in a connection."""
151+
"""
152+
An edge in a connection.
153+
"""
124154
type TodoEdge {
125-
"""The item at the end of the edge"""
155+
"""
156+
The item at the end of the edge
157+
"""
126158
node: Todo
127159

128-
"""A cursor for use in pagination"""
160+
"""
161+
A cursor for use in pagination
162+
"""
129163
cursor: String!
130164
}
131165

132166
type User implements Node {
133-
"""The ID of an object"""
167+
"""
168+
The ID of an object
169+
"""
134170
id: ID!
135-
todos(status: String = "any", after: String, first: Int, before: String, last: Int): TodoConnection
136-
totalCount: Int
171+
todos(
172+
status: String = "any"
173+
after: String
174+
first: Int
175+
before: String
176+
last: Int
177+
): TodoConnection
178+
totalCount: Int!
137179
completedCount: Int
138180
}

example-hooks/ts/__relay_artifacts__/AddTodoMutation.graphql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export type AddTodoMutationResponse = {
2424
} | null;
2525
readonly viewer: {
2626
readonly id: string;
27-
readonly totalCount: number | null;
27+
readonly totalCount: number;
2828
} | null;
2929
} | null;
3030
};

example-hooks/ts/__relay_artifacts__/RemoveCompletedTodosMutation.graphql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export type RemoveCompletedTodosMutationResponse = {
1313
readonly deletedTodoIds: ReadonlyArray<string | null> | null;
1414
readonly viewer: {
1515
readonly completedCount: number | null;
16-
readonly totalCount: number | null;
16+
readonly totalCount: number;
1717
} | null;
1818
} | null;
1919
};

example-hooks/ts/__relay_artifacts__/RemoveTodoMutation.graphql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export type RemoveTodoMutationResponse = {
1414
readonly deletedTodoId: string | null;
1515
readonly viewer: {
1616
readonly completedCount: number | null;
17-
readonly totalCount: number | null;
17+
readonly totalCount: number;
1818
} | null;
1919
} | null;
2020
};

example-hooks/ts/__relay_artifacts__/TodoApp_viewer.graphql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ReaderFragment } from "relay-runtime";
55
import { FragmentRefs } from "relay-runtime";
66
export type TodoApp_viewer = {
77
readonly id: string;
8-
readonly totalCount: number | null;
8+
readonly totalCount: number;
99
readonly " $fragmentRefs": FragmentRefs<"TodoListFooter_viewer" | "TodoList_viewer">;
1010
readonly " $refType": "TodoApp_viewer";
1111
};

example-hooks/ts/__relay_artifacts__/TodoListFooter_viewer.graphql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export type TodoListFooter_viewer = {
1414
} | null;
1515
} | null> | null;
1616
} | null;
17-
readonly totalCount: number | null;
17+
readonly totalCount: number;
1818
readonly " $refType": "TodoListFooter_viewer";
1919
};
2020
export type TodoListFooter_viewer$data = TodoListFooter_viewer;

example-hooks/ts/__relay_artifacts__/TodoList_viewer.graphql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export type TodoList_viewer = {
1414
} | null> | null;
1515
} | null;
1616
readonly id: string;
17-
readonly totalCount: number | null;
17+
readonly totalCount: number;
1818
readonly completedCount: number | null;
1919
readonly " $fragmentRefs": FragmentRefs<"Todo_viewer">;
2020
readonly " $refType": "TodoList_viewer";

example-hooks/ts/__relay_artifacts__/Todo_viewer.graphql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ReaderFragment } from "relay-runtime";
55
import { FragmentRefs } from "relay-runtime";
66
export type Todo_viewer = {
77
readonly id: string;
8-
readonly totalCount: number | null;
8+
readonly totalCount: number;
99
readonly completedCount: number | null;
1010
readonly " $refType": "Todo_viewer";
1111
};

example-hooks/ts/components/TodoApp.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ interface Props {
2626

2727
const TodoApp = (props: Props) => {
2828
const environment = useRelayEnvironment()
29-
const [append, setAppend] = React.useState<boolean>(false);
29+
const [append, setAppend] = React.useState<boolean>(false)
3030

3131
const viewer = useFragment(
3232
graphql`
@@ -46,7 +46,7 @@ const TodoApp = (props: Props) => {
4646

4747
const hasTodos = (viewer.totalCount || 0) > 0
4848

49-
const onSetAppend = () => setAppend(prev => !prev);
49+
const onSetAppend = () => setAppend(prev => !prev)
5050

5151
return (
5252
<div>

example-hooks/ts/components/TodoListFooter.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@ import RemoveCompletedTodosMutation from "../mutations/RemoveCompletedTodosMutat
1515
import React from "react"
1616
import { graphql, useRelayEnvironment, useFragment } from "react-relay/hooks"
1717

18-
import { TodoListFooter_viewer$key } from "../__relay_artifacts__/TodoListFooter_viewer.graphql"
18+
import {
19+
TodoListFooter_viewer$key,
20+
TodoListFooter_viewer,
21+
} from "../__relay_artifacts__/TodoListFooter_viewer.graphql"
1922

2023
interface Props {
2124
viewer: TodoListFooter_viewer$key
22-
onSetAppend: () => void;
23-
append: boolean;
25+
onSetAppend: () => void
26+
append: boolean
2427
}
2528

2629
const TodoListFooter = (props: Props) => {

0 commit comments

Comments
 (0)