Menu

Your fetch() Was Aborted. The Server Still Committed the Work?
📰

Your fetch() Was Aborted. The Server Still Committed the Work?

DEV Community: backend·Jamie Parker·1 day ago
#46MLgKCb
#devtobackend#devto#dev#server#client
Reading 0:00
15s threshold

A rejected fetch() promise does not tell you whether the server changed anything.

In a small local experiment, the client received AbortError , the server noticed the disconnected response, and the server's simulated write still completed. Adding a server cancellation handler prevented pending work. Moving the write earlier made cancellation too late.

Those three outcomes can look identical in a client log.

The result worth testing

Five scenarios ran five times each. Every run asserted both the client outcome and the final server counter: 25 scenario checks passed .

Here, “commit” means incrementing an in-memory counter.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.