Agent Wranglers

Data views Recommended

Show what loaded when one part fails

When a view combines several sources and one fails, show the parts that loaded and name the part that is missing.

How to do it

Load the sources independently and wait for all of them to settle, not for the first failure. Render each loaded part, and put a short notice with a retry button in place of the failed one. Never show totals that silently leave out a failed source. Hide the total or mark it as incomplete.

Example

const [orders, refunds, payouts] = await Promise.allSettled([loadOrders(), loadRefunds(), loadPayouts()]);
const dashboard = {
  orders: orders.status === 'fulfilled' ? orders.value : null,
  refunds: refunds.status === 'fulfilled' ? refunds.value : null,
  payouts: payouts.status === 'fulfilled' ? payouts.value : null,
};
const isTotalComplete = Object.values(dashboard).every(part => part !== null);
import asyncio

orders, refunds, payouts = await asyncio.gather(
    load_orders(), load_refunds(), load_payouts(), return_exceptions=True
)
dashboard = {name: None if isinstance(part, Exception) else part
             for name, part in {"orders": orders, "refunds": refunds, "payouts": payouts}.items()}
is_total_complete = all(part is not None for part in dashboard.values())

How to check

A test fails one of three sources. The other two render, the failed part shows its notice, and no total is shown as complete.

For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers app interface playbook: https://agentwranglers.se/playbook/app-ui/data-views/partial-results.