mirror of
https://github.com/NanmiCoder/claude-code-haha.git
synced 2026-10-10 11:53:10 +08:00
fix: merge QA-002 image fallback compatibility follow-up
This commit is contained in:
@@ -28,6 +28,7 @@ describe('AuthedImage', () => {
|
|||||||
fireEvent.error(screen.getByRole('img'))
|
fireEvent.error(screen.getByRole('img'))
|
||||||
|
|
||||||
await waitFor(() => expect(screen.getByRole('img')).toHaveAttribute('src', 'blob:x'))
|
await waitFor(() => expect(screen.getByRole('img')).toHaveAttribute('src', 'blob:x'))
|
||||||
|
expect(fetchServerImageBlobUrl).toHaveBeenCalledWith('http://127.0.0.1:1/a.png')
|
||||||
expect(onFailure).not.toHaveBeenCalled()
|
expect(onFailure).not.toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -72,6 +73,7 @@ describe('AuthedImage', () => {
|
|||||||
|
|
||||||
await waitFor(() => expect(screen.getByRole('img')).toHaveAttribute('src', 'blob:retry'))
|
await waitFor(() => expect(screen.getByRole('img')).toHaveAttribute('src', 'blob:retry'))
|
||||||
expect(fetchServerImageBlobUrl).toHaveBeenCalledTimes(1)
|
expect(fetchServerImageBlobUrl).toHaveBeenCalledTimes(1)
|
||||||
|
expect(fetchServerImageBlobUrl).toHaveBeenCalledWith('http://127.0.0.1:1/a.png', true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('ignores duplicate bare errors while authentication is pending and reports a decode failure once', async () => {
|
it('ignores duplicate bare errors while authentication is pending and reports a decode failure once', async () => {
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ export function useAuthedImageFallback(src: string | undefined, onFailure?: () =
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
current.state = 'fetching'
|
current.state = 'fetching'
|
||||||
void fetchServerImageBlobUrl(src, retryWithCredential).then((url) => {
|
const request = retryWithCredential ? fetchServerImageBlobUrl(src, true) : fetchServerImageBlobUrl(src)
|
||||||
|
void request.then((url) => {
|
||||||
if (!alive.current || attempt.current !== current) {
|
if (!alive.current || attempt.current !== current) {
|
||||||
URL.revokeObjectURL(url)
|
URL.revokeObjectURL(url)
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user