This repository was archived by the owner on Sep 27, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +83
-106
lines changed
example-hooks-gen/ts/components Expand file tree Collapse file tree 4 files changed +83
-106
lines changed Original file line number Diff line number Diff line change @@ -41,14 +41,40 @@ graphql`
4141 id
4242 text
4343 }
44- `
45-
46- graphql `
4744 fragment TodoViewer on User {
4845 id
4946 totalCount
5047 completedCount
5148 }
49+ mutation TodoRemoveMutation($input: RemoveTodoInput!) {
50+ removeTodo(input: $input) {
51+ deletedTodoId
52+ viewer {
53+ completedCount
54+ totalCount
55+ }
56+ }
57+ }
58+ mutation TodoRenameMutation($input: RenameTodoInput!) {
59+ renameTodo(input: $input) {
60+ todo {
61+ id
62+ text
63+ }
64+ }
65+ }
66+ mutation TodoChangeStatusMutation($input: ChangeTodoStatusInput!) {
67+ changeTodoStatus(input: $input) {
68+ todo {
69+ id
70+ complete
71+ }
72+ viewer {
73+ id
74+ completedCount
75+ }
76+ }
77+ }
5278`
5379
5480const Todo = ( props : Props ) => {
@@ -149,42 +175,4 @@ const Todo = (props: Props) => {
149175 )
150176}
151177
152- graphql `
153- mutation TodoRemoveMutation($input: RemoveTodoInput!) {
154- removeTodo(input: $input) {
155- deletedTodoId
156- viewer {
157- completedCount
158- totalCount
159- }
160- }
161- }
162- `
163-
164- graphql `
165- mutation TodoRenameMutation($input: RenameTodoInput!) {
166- renameTodo(input: $input) {
167- todo {
168- id
169- text
170- }
171- }
172- }
173- `
174-
175- graphql `
176- mutation TodoChangeStatusMutation($input: ChangeTodoStatusInput!) {
177- changeTodoStatus(input: $input) {
178- todo {
179- id
180- complete
181- }
182- viewer {
183- id
184- completedCount
185- }
186- }
187- }
188- `
189-
190178export default Todo
Original file line number Diff line number Diff line change @@ -44,16 +44,44 @@ graphql`
4444 ...TodoList
4545 @arguments(last: $last, first: $first, after: $after, before: $before)
4646 }
47- `
4847
49- graphql `
5048 mutation TodoAppSetAppendingMutation($isAppending: Boolean!) {
5149 setAppending(appending: $isAppending) {
5250 isAppending
5351 }
5452 }
55- `
5653
54+ mutation TodoAppAddTodoMutation(
55+ $input: AddTodoInput!
56+ $connections: [ID!]!
57+ $append: Boolean! = true
58+ ) {
59+ addTodo(input: $input) {
60+ todoEdge @include(if: $append) @appendEdge(connections: $connections) {
61+ __typename
62+ cursor
63+ node {
64+ complete
65+ id
66+ text
67+ }
68+ }
69+ todoEdge @skip(if: $append) @prependEdge(connections: $connections) {
70+ __typename
71+ cursor
72+ node {
73+ complete
74+ id
75+ text
76+ }
77+ }
78+ viewer {
79+ id
80+ totalCount
81+ }
82+ }
83+ }
84+ `
5785let tempID = 0
5886
5987const TodoApp = ( props : Props ) => {
@@ -119,37 +147,4 @@ const TodoApp = (props: Props) => {
119147 )
120148}
121149
122- graphql `
123- mutation TodoAppAddTodoMutation(
124- $input: AddTodoInput!
125- $connections: [ID!]!
126- $append: Boolean! = true
127- ) {
128- addTodo(input: $input) {
129- todoEdge @include(if: $append) @appendEdge(connections: $connections) {
130- __typename
131- cursor
132- node {
133- complete
134- id
135- text
136- }
137- }
138- todoEdge @skip(if: $append) @prependEdge(connections: $connections) {
139- __typename
140- cursor
141- node {
142- complete
143- id
144- text
145- }
146- }
147- viewer {
148- id
149- totalCount
150- }
151- }
152- }
153- `
154-
155150export default TodoApp
Original file line number Diff line number Diff line change @@ -50,6 +50,18 @@ graphql`
5050 completedCount
5151 ...TodoViewer
5252 }
53+ mutation TodoListMarkAllTodosMutation($input: MarkAllTodosInput!) {
54+ markAllTodos(input: $input) {
55+ changedTodos {
56+ id
57+ complete
58+ }
59+ viewer {
60+ id
61+ completedCount
62+ }
63+ }
64+ }
5365`
5466
5567const TodoList = ( props : Props ) => {
@@ -123,19 +135,4 @@ const TodoList = (props: Props) => {
123135 )
124136}
125137
126- graphql `
127- mutation TodoListMarkAllTodosMutation($input: MarkAllTodosInput!) {
128- markAllTodos(input: $input) {
129- changedTodos {
130- id
131- complete
132- }
133- viewer {
134- id
135- completedCount
136- }
137- }
138- }
139- `
140-
141138export default TodoList
Original file line number Diff line number Diff line change @@ -43,6 +43,17 @@ graphql`
4343 }
4444 totalCount
4545 }
46+ mutation TodoListFooterRemoveCompletedTodosMutation(
47+ $input: RemoveCompletedTodosInput!
48+ ) {
49+ removeCompletedTodos(input: $input) {
50+ deletedTodoIds
51+ viewer {
52+ completedCount
53+ totalCount
54+ }
55+ }
56+ }
4657`
4758
4859const TodoListFooter = ( props : Props ) => {
@@ -98,20 +109,6 @@ const TodoListFooter = (props: Props) => {
98109 )
99110}
100111
101- graphql `
102- mutation TodoListFooterRemoveCompletedTodosMutation(
103- $input: RemoveCompletedTodosInput!
104- ) {
105- removeCompletedTodos(input: $input) {
106- deletedTodoIds
107- viewer {
108- completedCount
109- totalCount
110- }
111- }
112- }
113- `
114-
115112function sharedRemoveCompletedTodosUpdater (
116113 store : RecordSourceSelectorProxy ,
117114 user : TodoListFooterData ,
You can’t perform that action at this time.
0 commit comments