fix(sharing): page the access log instead of stopping silently at twenty - #545
Open
MOHITKOURAV01 wants to merge 1 commit into
Open
fix(sharing): page the access log instead of stopping silently at twenty#545MOHITKOURAV01 wants to merge 1 commit into
MOHITKOURAV01 wants to merge 1 commit into
Conversation
The Sharing screen's second card is the patient's own audit trail — when a
provider read her records. It took `log.entries` and discarded `log.page`:
fetchAccessLog().catch(() => null)
...
setAccessLog(log?.entries ?? []);
One call, `limit = 20` by default, `hasMore` and `nextOffset` thrown away,
and then `.map` with no footer. No "load more", no count, no "showing 20
of N".
Truncating this list is worse than truncating an ordinary one, and in the
wrong direction. It is newest-first, so what falls off the end is the
*oldest* history — and the question she opens this screen to answer is
"has anyone been looking at my records, and since when". An unmarked
window reads as a complete history: "the earliest access shown is 3
August" and "the earliest of the twenty we felt like sending" are
indistinguishable to her.
Twenty rows is not a lot. `patient_summaries_page` writes one row per
patient per dashboard render, so a clinician who refreshes her roster four
times in a morning has already written four rows against everyone on it.
It also made the screen contradict itself. `viewCount` on each consent row
comes from `summary_for_patient`, computed over every record and unpaged,
so a row could read "viewed 34 times" above a list of 20 with no way to
reach the other 14.
This was the odd one out on the page: the consent list above it already
walks `nextOffset` to the end, and the provider dashboard already renders
a "Load more". Only the audit log stopped without saying so.
- Follows `page.hasMore` / `page.nextOffset` behind a "Show earlier views"
button, appending. `nextOffset` comes off the server's envelope rather
than being computed from `accessLog.length` — the server is the only
party that knows whether a short page means the history ended.
- Says how many are shown while more remain.
- A failed "load more" reports itself and keeps what is already on screen.
A patient who can see twenty rows and cannot fetch the twenty-first
should keep her twenty.
- The first fetch stays non-fatal, unchanged: a patient who cannot load
her history must still be able to revoke.
Three new `sharing.*` keys, added to every locale file that has a
`sharing` block, carrying English as those files already do for this
namespace. `bn.json` and `gu.json` have no `sharing` block at all — a
pre-existing gap tracked separately, and not one to half-fill here.
|
@MOHITKOURAV01 is attempting to deploy a commit to the ishita2740's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #540.
The Sharing screen's second card is the patient's own audit trail — "when a provider read your records". It showed the first 20 entries and stopped, with nothing on screen to say so.
One call,
limit = 20by default, andlog.page— which carrieshasMoreandnextOffset— discarded. Then.mapwith no footer: no "load more", no count, no "showing 20 of N".This was the odd one out on the page. The consent list directly above it follows the envelope to the end (
fetchConsentswalksnextOffsetuntilhasMoreis false), andProviderDashboardPagerenders an explicit "Load more". Only the audit log stopped silently.Why the truncation is worse here than on an ordinary list
The list is newest-first, so what falls off the end is the oldest history — and the question a patient opens this screen to answer is "has anyone been looking at my records, and since when". An unmarked window reads as a complete history: "the earliest access shown is 3 August" and "the earliest of the twenty we felt like sending" are indistinguishable to her.
Twenty rows is not a lot.
patient_summaries_pagewrites one row per patient per dashboard render, so a clinician refreshing her roster four times in a morning has already written four rows against every patient on it. A patient reaches the ceiling in days.It also made the screen contradict itself.
viewCounton each consent row comes fromsummary_for_patient, computed over every record, unpaged — so a row could read "viewed 34 times" while the list under it showed 20 and offered no way to reach the other 14.What this does
page.hasMore/page.nextOffset, with a "Load more" button, the wayProviderDashboardPagedoes. Entries are appended, andnextOffsetcomes off the server's envelope rather than being computed client-side — the server is the only party that knows whether a short page means the history ended..catch(() => null)and the comment explaining it are unchanged.PAGE_SIZEis a named constant matchingaccess_log_service.DEFAULT_ACCESS_LOG_PAGE, next to the oneProviderDashboardPagealready declares againstDEFAULT_PATIENTS_PAGE.New i18n keys —
sharing.accessLogLoadMore,sharing.accessLogShowing,sharing.accessLogLoadMoreError— added to every locale file that has asharingblock, carrying the English string exactly as the surroundingsharing.*entries in those files already do.bn.jsonandgu.jsonhave nosharingblock at all. That is a pre-existing gap tracked elsewhere (#297, #299) and not one worth half-filling from here — i18next falls back toenfor the whole namespace either way, which is what those two files already do for every other string on this screen.Tests
web/src/pages/SharingPage.test.tsxgains anaccess log paginggroup:hasMorerenders the "Load more" button; one that does not, does notoffset = nextOffset— the server's value, notentries.lengthExisting
SharingPagetests are unchanged. Eight of the nine new cases fail againstmain.Full web suite: 593 tests across 35 files,
npm run lintandnpm run buildclean.