Software DevelopmentBeginner 1 to 2 hours

Optimize Sequential API Calls

Fix a dashboard that takes 10 seconds to load because it fetches data one by one.

The Scenario

A dashboard needs data from 3 different microservices: User Profile, Recent Orders, and Support Tickets. Currently, the code uses `await fetchProfile()`, then `await fetchOrders()`, then `await fetchTickets()`. Each takes 1 second, so the page takes 3 seconds to load.

The Brief

Rewrite the code to fetch all 3 endpoints concurrently. Ensure that if the Support Tickets API fails, the User Profile and Recent Orders data are still returned to the frontend (with an error state for tickets).

Deliverables

  • The optimized data-fetching code snippet
  • An explanation of why `Promise.allSettled` is safer than `Promise.all` in this specific scenario

Submission Guidance

The goal is to reduce the total network time from 3 seconds to roughly 1 second. Pay close attention to error handling.

Submit Your Work

Your submission is graded against the rubric on the right. If you pass, you get a public Badge URL you can share on LinkedIn. There is no draft save, so work offline first and paste your finished response here.

This appears on your public Badge.

0/20000 charactersMarkdown supported

One per line or comma separated. Up to 5 links.

By submitting, you agree your submission text, name, and evaluation will appear on a public Badge URL.