| 108 | } |
| 109 | |
| 110 | private seedCacheOnlyTodo(): void { |
| 111 | this.cacheSeedCount += 1 |
| 112 | |
| 113 | const seedTodo: Todo = { |
| 114 | id: 10000 + this.cacheSeedCount, |
| 115 | title: `Seeded cache todo ${this.cacheSeedCount}`, |
| 116 | } |
| 117 | |
| 118 | demoQueryClient.setQueryData<TodosResponse>( |
| 119 | todosQueries.list().queryKey, |
| 120 | (existing) => { |
| 121 | if (!existing) { |
| 122 | return { |
| 123 | items: [seedTodo], |
| 124 | requestCount: 0, |
| 125 | source: 'cache', |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | return { |
| 130 | items: [...existing.items, seedTodo], |
| 131 | requestCount: existing.requestCount, |
| 132 | source: 'cache', |
| 133 | } |
| 134 | }, |
| 135 | ) |
| 136 | } |
| 137 | |
| 138 | private forceNextFetchFailure(): void { |
| 139 | failNextFetchRequest() |