{"slug": "model-couldnt-check-as-a-different-state-from-zero-results", "title": "Model “Couldn’t Check” as a Different State From Zero Results", "summary": "A developer at Primetime Home Health Services published a synthetic TypeScript example showing how to model a dashboard's \"couldn't check\" state as distinct from a genuine zero-result state, using a discriminated union of checked, stale, and unavailable queue states. The example warns that a failed request should not default to a zero count, that a new network attempt should not overwrite the last successful check timestamp, and that partial responses should be treated as unavailable. It also advises keeping status readable without color and testing in-place updates for assistive-technology announcements.", "body_md": "*From Primetime Home Health Services. Prepared with AI drafting assistance. This is a synthetic TypeScript example for a generic staff queue, not a live PTHHS screen or a decision about care, pay, or eligibility.*\n\nA dashboard that says “0 items” is making a claim: the last check succeeded and found none. If the request failed, a zero is the wrong default. The difference matters when an office is deciding whether anyone still needs to review the queue.\n\n```\ntype Queue =\n  | { kind: \"checked\"; count: number; at: string }\n  | { kind: \"stale\"; at: string }\n  | { kind: \"unavailable\" };\n\nfunction message(s: Queue) {\n  switch (s.kind) {\n    case \"checked\":\n      return `${s.count} items need review. Checked at ${s.at}.`;\n    case \"stale\":\n      return `Refresh failed. Last checked at ${s.at}; the earlier count may have changed.`;\n    case \"unavailable\":\n      return \"Couldn’t check the list. Try refreshing.\";\n  }\n}\n```\n\nHere, `at` stands for the last completed check for this same view, formatted clearly for the reader. A new network attempt should not overwrite it with a fresh clock time. Treat a partial response as unavailable for this total rather than reporting it as a complete check. Do not carry a result across a change in the source, active view or session.\n\nKeep the status readable without color. For an in-place update, test that assistive technology can announce it without pulling focus from the person’s current task. See [W3C’s status-message guidance](https://www.w3.org/WAI/WCAG22/Understanding/status-messages.html). Test with invented values, not office records.\n\n[Read the exact PTHHS original, Why Healthcare AI Should Learn From Mistakes](https://pthhs.net/articles/why-healthcare-ai-should-learn-from-mistakes), for the administrative context. Published from [Jeremy Nwokorie’s](https://www.linkedin.com/in/jeremynwokorie/) account on behalf of Primetime Home Health Services.", "url": "https://wpnews.pro/news/model-couldnt-check-as-a-different-state-from-zero-results", "canonical_source": "https://dev.to/jeremynwokorie/model-couldnt-check-as-a-different-state-from-zero-results-4jie", "published_at": "2026-11-22 02:08:34+00:00", "updated_at": "2026-11-22 02:12:36.387472+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["Primetime Home Health Services", "Jeremy Nwokorie", "W3C"], "also_reported_by": [], "takeaway": "Model a dashboard's fetch state as a discriminated union of checked, stale, and unavailable rather than defaulting to zero, and never overwrite the last successful check timestamp with a new attempt's clock time.", "recommendation": {"advice": "Represent queue status as checked, stale, or unavailable instead of defaulting to zero, and preserve the last successful check timestamp so users can tell a failed refresh from a genuine empty result.", "playbook": "production-ops", "playbook_url": "https://wpnews.pro/playbooks/production-ops"}, "alternates": {"html": "https://wpnews.pro/news/model-couldnt-check-as-a-different-state-from-zero-results", "markdown": "https://wpnews.pro/news/model-couldnt-check-as-a-different-state-from-zero-results.md", "text": "https://wpnews.pro/news/model-couldnt-check-as-a-different-state-from-zero-results.txt", "jsonld": "https://wpnews.pro/news/model-couldnt-check-as-a-different-state-from-zero-results.jsonld"}}