Merge pull request #8588 from penpot/niwinz-staging-abort-signal-fix

🐛 Fix unhandled AbortError in HTTP fetch requests
This commit is contained in:
Alejandro Alonso 2026-03-12 13:53:18 +01:00 committed by GitHub
commit be9b1158ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 2 deletions

View File

@ -343,7 +343,12 @@
(= message "Possible side-effect in debug-evaluate")
(= message "Unexpected end of input")
(str/starts-with? message "invalid props on component")
(str/starts-with? message "Unexpected token "))))
(str/starts-with? message "Unexpected token ")
;; Abort errors are expected when an in-flight HTTP request is
;; cancelled (e.g. via RxJS unsubscription / take-until). They
;; are handled gracefully inside app.util.http/fetch and must
;; NOT be surfaced as application errors.
(= (.-name ^js cause) "AbortError"))))
(on-unhandled-error [event]
(.preventDefault ^js event)

View File

@ -123,10 +123,15 @@
(/ current-time (inc count)))
count (inc count)]
(swap! network-averages assoc (:path uri) {:count count :average average})))))
(fn []
(vreset! unsubscribed? true)
(when @abortable?
(.abort ^js controller)))))))
;; Provide an explicit reason so that the resulting AbortError carries
;; a meaningful message instead of the browser default
;; "signal is aborted without reason".
(.abort ^js controller (ex-info (str "fetch to '" uri "' is aborted")
{:uri uri}))))))))
(defn response->map
[response]