Skip to content

Commit 7dcc7eb

Browse files
committed
Revert "stash demo prep changes"
This reverts commit d3a7230.
1 parent e29505d commit 7dcc7eb

10 files changed

+32
-77
lines changed

example-hooks/data/schema.graphql

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

46-
"""
47-
An object with an ID
48-
"""
44+
"""An object with an ID"""
4945
interface Node {
50-
"""
51-
The id of the object.
52-
"""
46+
"""The id of the object."""
5347
id: ID!
5448
}
5549

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

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

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

75-
"""
76-
When paginating forwards, the cursor to continue.
77-
"""
61+
"""When paginating forwards, the cursor to continue."""
7862
endCursor: String
7963
}
8064

8165
type Query {
8266
viewer: User
8367

84-
"""
85-
Fetches an object given its ID
86-
"""
68+
"""Fetches an object given its ID"""
8769
node(
88-
"""
89-
The ID of an object
90-
"""
70+
"""The ID of an object"""
9171
id: ID!
9272
): Node
9373
}
@@ -125,56 +105,34 @@ type RenameTodoPayload {
125105
}
126106

127107
type Todo implements Node {
128-
"""
129-
The ID of an object
130-
"""
108+
"""The ID of an object"""
131109
id: ID!
132110
text: String
133111
complete: Boolean
134112
}
135113

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

145-
"""
146-
A list of edges.
147-
"""
119+
"""A list of edges."""
148120
edges: [TodoEdge]
149121
}
150122

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

160-
"""
161-
A cursor for use in pagination
162-
"""
128+
"""A cursor for use in pagination"""
163129
cursor: String!
164130
}
165131

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

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;
27+
readonly totalCount: number | null;
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;
16+
readonly totalCount: number | null;
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;
17+
readonly totalCount: number | null;
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;
8+
readonly totalCount: number | null;
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;
17+
readonly totalCount: number | null;
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;
17+
readonly totalCount: number | null;
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;
8+
readonly totalCount: number | null;
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: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,12 @@ import RemoveCompletedTodosMutation from "../mutations/RemoveCompletedTodosMutat
1515
import React from "react"
1616
import { graphql, useRelayEnvironment, useFragment } from "react-relay/hooks"
1717

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

2320
interface Props {
2421
viewer: TodoListFooter_viewer$key
25-
onSetAppend: () => void
26-
append: boolean
22+
onSetAppend: () => void;
23+
append: boolean;
2724
}
2825

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

0 commit comments

Comments
 (0)