Handle promise result

Handle promise result in JavaScript — with the four heights of help laid out: do it now, make it easier for the next person to accept, work out the right move when you are stuck, and learn the pattern so it stops coming back.

4prompt heights
Open it in the interactive atlas →

The four heights

The same task, four distances: today's deadline, the next reviewer, the stuck moment, the pattern.

Execute — do the immediate task

+
A promise returns data we need to render. Add a .then handler that extracts response.data, update…
A promise returns data we need to render. Add a .then handler that extracts response.data, update state with the value, add a .catch that logs a clear error with context, and ensure a loading flag is set false in both success and failure paths.

Improve — make it easier to accept

+
Before I change the component to use the promise result, make the flow easy to review. Show where…
Before I change the component to use the promise result, make the flow easy to review. Show where to extract response.data, how to update setState safely if the component might unmount, and provide an error message that tells a reviewer whether this failure is recoverable or not.

Decide — diagnose the stuck moment

+
I added a .then to call setItems(response.data) but the list stays empty. I suspect the response…

The promise resolves but I still see empty UI

I added a .then to call setItems(response.data) but the list stays empty. I suspect the response shape is wrong or setState runs after unmount. I don't know which. How do I quickly tell whether response.data is empty versus setState being ignored and what minimal change unblocks the UI now?

Become — change the pattern

+
Across projects we keep getting race conditions: components update state after unmount or assume…

We repeatedly mishandle async results and leak state updates

Across projects we keep getting race conditions: components update state after unmount or assume promise shapes. I want a practical rule to avoid these bugs. Recommend one pattern for handling promises in components, one test to add to our suite to catch stale updates, and a brief PR lint item reviewers should check.

Next to this one

Other programming language work people do in JavaScript.

Every task here came from the work, not from a feature list — which is why the prompts name what you want done and never the button that does it. The tool changes; the work does not.
Copyright © LLOS.ai · 2026 — original pedagogy, voice, and design — all rights reserved.

The rest of the map

Same library, five ways in.