( imagePath: string, note: string, )
| 140 | * Error images are automatically removed after AUTO_REMOVE_ERROR_DELAY_MS. |
| 141 | */ |
| 142 | export function addPendingImageWithError( |
| 143 | imagePath: string, |
| 144 | note: string, |
| 145 | ): void { |
| 146 | const filename = path.basename(imagePath) |
| 147 | useChatStore.getState().addPendingImage({ |
| 148 | path: imagePath, |
| 149 | filename, |
| 150 | status: 'error', |
| 151 | note, |
| 152 | }) |
| 153 | |
| 154 | // Clear any existing timer for this path (shouldn't happen, but be safe) |
| 155 | const existingTimer = errorImageTimers.get(imagePath) |
| 156 | if (existingTimer) { |
| 157 | clearTimeout(existingTimer) |
| 158 | } |
| 159 | |
| 160 | // Auto-remove error images after a delay |
| 161 | const timer = setTimeout(() => { |
| 162 | errorImageTimers.delete(imagePath) |
| 163 | useChatStore.getState().removePendingImage(imagePath) |
| 164 | }, AUTO_REMOVE_ERROR_DELAY_MS) |
| 165 | |
| 166 | errorImageTimers.set(imagePath, timer) |
| 167 | } |
| 168 | |
| 169 | /** |
| 170 | * Clear the auto-remove timer for an error image. |
no test coverage detected