fix(ui): handle abort() call signal error (#7390)

## Description

Swallows `.abort()` call signal errors

- [x] I have read and understand the
[CONTRIBUTING.md](https://github.com/payloadcms/payload/blob/main/CONTRIBUTING.md)
document in this repository.

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)

## Checklist:

- [x] Existing test suite passes locally with my changes
This commit is contained in:
Patrik
2024-07-26 13:16:22 -04:00
committed by GitHub
parent f9e5573c1e
commit 5655266daa
4 changed files with 24 additions and 4 deletions

View File

@@ -220,7 +220,13 @@ export const Autosave: React.FC<Props> = ({
return () => {
if (autosaveTimeout) clearTimeout(autosaveTimeout)
if (abortController.signal) abortController.abort()
if (abortController.signal) {
try {
abortController.abort()
} catch (error) {
// swallow error
}
}
setSaving(false)
}
}, [

View File

@@ -248,7 +248,13 @@ export const RelationshipField: React.FC<Props> = (props) => {
return () => {
abortControllers.forEach((controller) => {
if (controller.signal) controller.abort()
if (controller.signal) {
try {
controller.abort()
} catch (error) {
// swallow error
}
}
})
}
}, [i18n, loadRelationOptions, relationTo])

View File

@@ -89,7 +89,11 @@ export const usePayloadAPI: UsePayloadAPI = (url, options = {}) => {
}
return () => {
abortController.abort()
try {
abortController.abort()
} catch (error) {
// swallow error
}
}
}, [url, locale, search, i18n.language, initialData])

View File

@@ -455,7 +455,11 @@ const DocumentInfo: React.FC<
}
return () => {
abortController.abort()
try {
abortController.abort()
} catch (error) {
// swallow error
}
}
}, [
api,