Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk3 min

Why Returning a Promise Inside .then() Changes What Runs Next

Returning a promise from a .then() handler makes the next handler in that chain wait for it to settle. Omitting return leaves the inner promise disconnected.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Returning a promise from a .then() handler makes the next link in that promise chain wait for it to settle. Without the return, the inner promise is not connected to the chain, so the next handler can run independently. This changes the chain’s dependencies—not whether the handler itself runs asynchronously.

What returning the promise changes

Each call to .then() immediately creates a new promise. Its handler runs asynchronously, even if the promise it is attached to has already settled. The new promise’s state depends on what the handler does:

As an Amazon Associate I earn from qualifying purchases.

  • If the handler returns an ordinary value, the new promise fulfills with that value.
  • If the handler returns nothing, it returns undefined, and the new promise fulfills with undefined.
  • If the handler throws, the new promise rejects with the thrown error.
  • If the handler returns a promise or thenable, the new promise adopts its eventual fulfillment or rejection.

That last case connects the returned operation to the chain. The next handler in that chain cannot run until the returned promise settles; on fulfillment, it receives the adopted value. A rejection continues down the chain until a handler handles it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

See the difference in code

Returning the promise

const wait = (label, ms) => new Promise((resolve) => {
  setTimeout(() => {
    console.log(`${label} finished`);
    resolve(label);
  }, ms);
});

Promise.resolve()
  .then(() => {
    console.log("first handler");
    return wait("inner work", 0);
  })
  .then((value) => {
    console.log("next handler after", value);
  });

The first handler returns the timer-backed promise. The next handler is therefore linked to its settlement and receives the resolved label.

Leaving the promise unreturned

Promise.resolve()
  .then(() => {
    console.log("first handler");
    wait("inner work", 0); // Not returned: the chain does not wait for it.
  })
  .then(() => {
    console.log("next handler");
  });

The first handler falls through and returns undefined. The outer chain has no dependency on the promise created by wait, so its next handler can run before the timer callback. The timer output’s exact placement can depend on surrounding work and the host environment; the reliable distinction is whether the promise is returned.

Why “execution order” can be misleading

There are two separate ordering rules to keep in view:

  • Handler scheduling: promise handlers run asynchronously as microtasks, after the current synchronous code has completed. This remains true whether or not a handler returns another promise. MDN states that “The call always happens asynchronously, even when the current promise is already settled.” See MDN’s Promise.prototype.then() reference.
  • Chain dependency: returning a promise makes the chain’s next promise follow it. Omitting the return leaves that inner promise detached from the outer chain.

Returning a promise does not block JavaScript or stop unrelated work. It delays only downstream steps that depend on that promise in the same chain. The language-level behavior is specified in ECMAScript 2025.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Return asynchronous work when the next step depends on it

A common bug occurs with a block-bodied arrow function, which needs an explicit return:

fetchData().then((data) => {
  saveData(data); // The chain does not wait for this promise.
});

If a later step must wait for the save, return its promise:

fetchData().then((data) => {
  return saveData(data);
}).then(() => {
  console.log("save finished");
});

An expression-bodied arrow returns its expression implicitly, so this also connects saveData to the chain:

fetchData().then((data) => saveData(data));
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Separate handlers on one promise are separate chains

Handlers attached directly to the same promise run in the order they were registered. But each .then() call creates its own resulting promise; one handler’s returned work does not make another separately attached chain wait for it. To express a dependency between operations, attach the later step to the promise returned by the earlier .then().

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.