| 117 | } |
| 118 | |
| 119 | private seedCacheOnlyTodo(): void { |
| 120 | this.cacheSeedCount += 1 |
| 121 | |
| 122 | const seedTodo: Todo = { |
| 123 | id: 10_000 + this.cacheSeedCount, |
| 124 | title: `Seeded cache todo ${this.cacheSeedCount}`, |
| 125 | } |
| 126 | |
| 127 | demoQueryClient.setQueryData<TodosResponse>(['todos'], (existing) => { |
| 128 | if (!existing) { |
| 129 | return { |
| 130 | items: [seedTodo], |
| 131 | requestCount: 0, |
| 132 | source: 'cache', |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | return { |
| 137 | items: [...existing.items, seedTodo], |
| 138 | requestCount: existing.requestCount, |
| 139 | source: 'cache', |
| 140 | } |
| 141 | }) |
| 142 | } |
| 143 | |
| 144 | private forceNextFetchFailure(): void { |
| 145 | failNextFetchRequest() |