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`
41
41
id
42
42
text
43
43
}
44
- `
45
-
46
- graphql `
47
44
fragment TodoViewer on User {
48
45
id
49
46
totalCount
50
47
completedCount
51
48
}
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
+ }
52
78
`
53
79
54
80
const Todo = ( props : Props ) => {
@@ -149,42 +175,4 @@ const Todo = (props: Props) => {
149
175
)
150
176
}
151
177
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
-
190
178
export default Todo
Original file line number Diff line number Diff line change @@ -44,16 +44,44 @@ graphql`
44
44
...TodoList
45
45
@arguments(last: $last, first: $first, after: $after, before: $before)
46
46
}
47
- `
48
47
49
- graphql `
50
48
mutation TodoAppSetAppendingMutation($isAppending: Boolean!) {
51
49
setAppending(appending: $isAppending) {
52
50
isAppending
53
51
}
54
52
}
55
- `
56
53
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
+ `
57
85
let tempID = 0
58
86
59
87
const TodoApp = ( props : Props ) => {
@@ -119,37 +147,4 @@ const TodoApp = (props: Props) => {
119
147
)
120
148
}
121
149
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
-
155
150
export default TodoApp
Original file line number Diff line number Diff line change @@ -50,6 +50,18 @@ graphql`
50
50
completedCount
51
51
...TodoViewer
52
52
}
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
+ }
53
65
`
54
66
55
67
const TodoList = ( props : Props ) => {
@@ -123,19 +135,4 @@ const TodoList = (props: Props) => {
123
135
)
124
136
}
125
137
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
-
141
138
export default TodoList
Original file line number Diff line number Diff line change @@ -43,6 +43,17 @@ graphql`
43
43
}
44
44
totalCount
45
45
}
46
+ mutation TodoListFooterRemoveCompletedTodosMutation(
47
+ $input: RemoveCompletedTodosInput!
48
+ ) {
49
+ removeCompletedTodos(input: $input) {
50
+ deletedTodoIds
51
+ viewer {
52
+ completedCount
53
+ totalCount
54
+ }
55
+ }
56
+ }
46
57
`
47
58
48
59
const TodoListFooter = ( props : Props ) => {
@@ -98,20 +109,6 @@ const TodoListFooter = (props: Props) => {
98
109
)
99
110
}
100
111
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
-
115
112
function sharedRemoveCompletedTodosUpdater (
116
113
store : RecordSourceSelectorProxy ,
117
114
user : TodoListFooterData ,
You can’t perform that action at this time.
0 commit comments