mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-12 06:06:10 +00:00
fix(insights): keep the assessment card polling while a stale text revalidates
The stale-while-revalidate path serves the last-good assessment on a cache miss and returns a terminal payload, so the status hook stopped polling. The worker warmed a fresh assessment out of band seconds later, but the open card never picked it up — the stale text stuck until the page remounted. Add a `revalidating` flag to the read-only miss outcome, set only when last-good text is served AND a refresh was enqueued (false on the suppressed-stub branch and when no prior text exists). Thread it through the generic metric-status generator and the seven specialised generators onto the wire, type it on the client, and make `nextStatusPollInterval` keep polling on `preparing || revalidating`. The existing 12-attempt ceiling bounds both signals, so a persistently failing generation still cannot poll forever. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> (cherry picked from commit c9217534fbdb304c4df1b6eb55fb19e4360b8a10)
This commit is contained in:
1 parent
03925ddece
commit
3694efe6e8
15 files changed
+125
-10
No files matched your search
@@ -63,6 +63,9 @@ interface MedicationComplianceStatusData {
|
||||
// cache miss while the worker warms the assessment; the card polls until
|
||||
// it lands. See `use-insight-status.ts` for the shared rationale.
|
||||
preparing?: boolean;
|
||||
// v1.9.0 — last-good narrative served while a refresh is in flight; the
|
||||
// card keeps polling (bounded) so the open page upgrades in-session.
|
||||
revalidating?: boolean;
|
||||
}
|
||||
|
||||
// v1.8.3 — client ceiling on the round-trip, mirroring the shared
|
||||
@@ -129,6 +132,7 @@ export default function InsightsMedikamentePage() {
|
||||
nextStatusPollInterval(
|
||||
query.state.data?.preparing,
|
||||
query.state.dataUpdateCount,
|
||||
query.state.data?.revalidating,
|
||||
),
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user