Skip to content

Recent pages across Work and Clinical, and a start list on Clinical mode homes - #3498

Merged
gitar-bot[bot] merged 13 commits into
mainfrom
claude/site-clinical-recent-xk2j9i
Oct 13, 2026
Merged

gitar-bot[bot] merged 13 commits into
mainfrom
claude/site-clinical-recent-xk2j9i

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner

User description

🤖 Generated with Claude Code

https://claude.ai/code/session_01Mws6schjKQbpCQqQzPMKSL

Summary

Before: the DSM, Medication, Therapy, Documents and Differentials homes showed only an icon, a title and the search box, and there was no way back to a page you had just looked at except searching again.

After: under the unchanged search box, each of those homes shows "Continue" (the last three records opened in that mode), read-only Favourites where the mode has them, and a "Browse all" link where a catalogue page exists. A "Recent pages" list (last five) appears in the side menu's Work and Clinical tabs and in AI Search's empty state.

How: a new device-only store keeps the last 12 pages (title, path without query, mode, section, time). It records record pages and Work area homes and tabs only. It never records searches, call notes, handover, referrals, the MHA clock, safety plans, drafts, First Nations pages, mock-ups or developer pages, and refuses any address with typed-looking text. It only records while "Save recent searches" is on, and is cleared with recent searches and at sign-out or account switch. The search box placeholders on DSM and Medication are shortened so they fit at 390 px.

Areas touched: App experience, Data platform and access, Personal practice (plus 7 files not yet placed in any area)

Verification

  • eslint on changed files: clean. Typecheck: pass. Prettier: formatted.
  • npm run test:focused: 809 files, 11,461 tests passed.
  • Screenshots before and after for all five homes at 320, 390 and 1440 px, light and dark, first visit and returning, plus side menu and AI Search. The composer is unchanged apart from the shorter placeholders.
  • Full browser suite (including Firefox, Safari and phone) to be run on this draft by a manual browser-matrix dispatch.

Risk and rollout

  • Display only. No clinical wording, ranking, retrieval or search order changes. No migration, no service worker change.
  • Privacy: the list is kept on the device only and follows the existing recent-searches switch.
  • Rollback: revert this PR.

Notes

Site-wide recommendations 3 and 4 (12 Oct 2026).

Generated by Claude Code

Summary by cubic

Adds a device-only "Recent pages" list across Work and Clinical, and start lists on the Clinical mode homes, so returning to a record no longer requires a fresh search.

  • The side menu's Work and Clinical tabs and AI Search's empty state show the last five pages opened.
  • DSM, Medication, Therapy, Documents, and Differentials homes show "Continue" (that mode's last three records), read-only Favourites, and a "Browse all" link where a catalogue page exists.
  • A device-only store keeps the last 12 pages (path without query, title, mode, section, time), aging entries out after 90 days; DSM and Medication search placeholders were shortened to fit at 390 px.
  • Document pages hand their on-screen name to the recorder because the viewer's tab title is only "PsychSift"; the recorder draws nothing and loads only after the page, and a navigation never saves the previous page's title under the new path while the route loads.

Privacy:

  • Records record and work area pages only; searches, call notes, handover, the MHA clock, safety plans, drafts, roster requests, and any query carrying typed-looking text are never stored, and nothing records while "Save recent searches" is off.
  • Titles that could name a patient are never kept; a clear or account change stops a page still settling its title from writing back.
  • Favourites read only the mode's saved slugs with no service or form registry request; the therapy catalogue loads only on the Therapy home.
  • The list is cleared with recent searches and on sign-out or account switch.

Written for commit 7f011d0. Summary will update on new commits.

View guided diff Turn on auto-fix

Summary by Gitar

  • Recent pages list:
    • Added device-only store keeping last 12 record and Work area pages, paths without queries
  • Clinical mode start lists:
    • Added Continue, Favourites and Browse groups under DSM, Medication, Therapy, Documents and Differentials homes
  • Side menu and AI Search:
    • Added Recent pages list (last five) to Work and Clinical tabs
  • Privacy:
    • Recording follows Save recent searches switch and clears at sign-out and account switch

This will update automatically on new commits.


CodeAnt-AI Description

Resume recent pages and start faster from Clinical mode homes

What Changed

  • Recent pages from Work and Clinical appear in the side menus and AI Search, with the current page omitted.
  • DSM, Medication, Therapy, Documents and Differentials homes offer the last three records opened in that mode. Therapy and Differentials also show saved favourites, and DSM, Therapy and Differentials link to their catalogues.
  • Recent pages are kept on the device only while “Save recent searches” is on. Searches and sensitive work pages are excluded; history clears with recent searches and at sign-out or account change.
  • Shortened DSM and Medication search prompts so they fit more easily on narrow screens.

Impact

✅ Resume records across Work and Clinical
✅ Continue clinical work without searching again
✅ No recent-page history when saving is off

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

…ode homes

Recent pages: a device-only list (capped at 12) of record and work area
pages opened, path without query, title, mode and time. Never call notes,
handover, the MHA clock, drafts, searches, First Nations, mock-ups or
developer pages. Recorded only while "Save recent searches" is on, cleared
with recent searches and at every account transition. Shown (last five) in
the phone menu's Work and Clinical tabs, the two-pane menu and AI Search's
empty state; hidden when empty.

Clinical mode homes (DSM, Medication, Therapy, Documents, Differentials):
Continue (last three records of the mode), the mode's Favourites (read only)
and a Browse all link where a catalogue page exists, hanging below the home
so the centred hero and composer keep their exact place. Shorter DSM and
Medication placeholders so they are not cut off at 390 px.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mws6schjKQbpCQqQzPMKSL
@supabase

supabase Bot commented Oct 12, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@BigSimmo BigSimmo self-assigned this Oct 12, 2026
@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 4948f52f-5105-41e4-8da1-5722035ace80
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codeant-ai

codeant-ai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

🏁 CodeAnt Quality Gate Results

Commit: 7f011d06
Scan Time: 2026-10-13 01:58:31 UTC

✅ Overall Status: PASSED

Quality Gate Details

Quality Gate Status Details
Secrets ✅ PASSED 0 secrets found
Duplicate Code ✅ PASSED 0.0% duplicated
SAST ✅ PASSED No security issues
Bugs ✅ PASSED Rating S: No bugs
IAC ✅ PASSED No IAC issues

View Full Results

Comment thread src/lib/recent-pages.ts Resolved
@codspeed

codspeed Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 13.46%

⚠️ 2 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
✅ 7 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ clinical-search: classifyRagQuery 1,107.4 µs 976 µs +13.46%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing claude/site-clinical-recent-xk2j9i (7f011d0) with main (539867b)

Open in CodSpeed

… title, lighter favourites

- Document pages hand the title already loaded for the viewer to the
  recorder (no new data read), since their tab title is only "PsychSift".
- The recorder captures the tab title as a navigation starts and records
  nothing while it is unchanged, so a new path is never saved under the
  previous page's name (a cold load is exempt).
- Mode home Favourites read only that mode's saved slugs: no service or form
  registry request, and the therapy catalogue loads on the Therapy home only.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mws6schjKQbpCQqQzPMKSL
gitar-bot[bot]
gitar-bot Bot previously approved these changes Oct 12, 2026

@gitar-bot gitar-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gitar has auto-approved this PR (configure)

Copy link
Copy Markdown
Owner Author

Full browser suite on this draft (run 38261188981, failed jobs re-run once): Chromium, Firefox, iPad and every iPhone Safari job are green after the re-run.

One desktop Safari job failed on both attempts, but on a different test each time: first ui-phone-scroll-assessments.spec.ts:19 (the assessments hero briefly rendered twice), then ui-phone-scroll.spec.ts:33 for the CME programme page. The assessments failure also appears on #3499 and is part of main's iPhone/Safari backlog (ledger #9Z197J), and neither page is touched by this PR (Recent pages, mode-home start lists). The first-attempt iPhone failures (ui-on-call-boards.spec.ts:558, ui-dictionary.spec.ts:131, assessments) are the same known backlog and passed on re-run. Not this PR's; marking ready.


Generated by Claude Code

@codeant-ai

codeant-ai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Incremental review completed 7f011d0 Oct 13, 2026 · 01:43 01:44
✅ Incremental review completed 8f33add Oct 12, 2026 · 21:04 21:05
✅ Incremental review completed e565426 Oct 12, 2026 · 19:18 19:19
✅ Incremental review completed 78f272a Oct 12, 2026 · 17:01 17:02
✅ Reviewed your PR b006b21 Oct 12, 2026 · 15:58 16:05

@codeant-ai

codeant-ai Bot commented Oct 12, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BigSimmo has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@gitar-bot
gitar-bot Bot enabled auto-merge (squash) October 12, 2026 15:59
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T16:04:54.604121Z b006b21 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codeant-ai codeant-ai Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files label Oct 12, 2026
@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Add recent pages and Clinical mode home start lists

✨ Enhancement 🧪 Tests 🕐 40+ Minutes

Grey Divider

AI Description

• Keep a device-only history of eligible Work and Clinical pages for quick return navigation.
• Show recent pages in menus and AI Search, and Continue, Favourites and Browse on five Clinical
 homes.
• Respect the recent-searches privacy switch and clear page history with searches or account
 transitions.
Diagram

graph TD
  Routes["Eligible pages"] --> Recorder["Page recorder"] --> Store[("Recent pages")] --> Menus["Side menus"]
  Store --> Search["AI Search"]
  Store --> Homes["Clinical homes"]
  Favourites["Account favourites"] --> Homes
  Settings["Privacy settings"] --> Recorder
  Settings --> Store
Loading
High-Level Assessment

The device-local, route-allowlisted store fits a convenience history governed by the existing privacy switch. Reusing account favourites and the shared home template avoids a new service or separate per-mode history.

Files changed (24) +1508 / -18

Enhancement (18) +1049 / -17
page.tsxSupply document titles to recent-page recording +16/-10

Supply document titles to recent-page recording

• Passes the already-loaded document title to the recorder because the viewer's browser title does not identify the document.

src/app/(search-app)/documents/[id]/page.tsx

layout.tsxMount the recent-pages recorder +2/-0

Mount the recent-pages recorder

• Adds a recorder to the shared search-app layout so eligible navigation can be captured across modes.

src/app/(search-app)/layout.tsx

ClinicalSidebar.tsxShow recent pages in the Clinical drawer +3/-0

Show recent pages in the Clinical drawer

• Adds the recent-page group to the Clinical tab of the drawer.

src/components/clinical-dashboard/ClinicalSidebar.tsx

answer-status.tsxEnable start lists on selected Clinical homes +2/-0

Enable start lists on selected Clinical homes

• Passes a start list to the shared home for DSM, Medication, Therapy, Documents and Differentials without changing other modes.

src/components/clinical-dashboard/answer-status.tsx

clinical-menu-drawer.tsxAdd recent-page links to phone menu tabs +97/-1

Add recent-page links to phone menu tabs

• Shows up to five recent pages across Work and Clinical, with section labels, and hides the group when empty.

src/components/clinical-dashboard/clinical-menu-drawer.tsx

settings-dialog.tsxClear page history with recent searches +5/-2

Clear page history with recent searches

• Includes recent pages in the displayed recent-item count and clears them when searches are cleared or saving is disabled.

src/components/clinical-dashboard/settings-dialog.tsx

mode-home-favourites-group.tsxShow saved favourites on applicable mode homes +88/-0

Show saved favourites on applicable mode homes

• Displays read-only differential and therapy favourites from account data. Therapy names are resolved from the catalogue only when needed.

src/components/mode-home-favourites-group.tsx

mode-home-start-list.tsxBuild Clinical home Continue and Browse groups +160/-0

Build Clinical home Continue and Browse groups

• Configures five mode homes to show up to three recent records, applicable favourites and a catalogue link where one exists.

src/components/mode-home-start-list.tsx

mode-home-template.tsxPlace start lists below the home content +17/-1

Place start lists below the home content

• Adds an optional, out-of-flow start-list slot below the home to preserve the centred hero and search composer positions.

src/components/mode-home-template.tsx

recent-page-title.tsxAnnounce titles for pages with generic browser titles +17/-0

Announce titles for pages with generic browser titles

• Provides a client-side bridge for pages such as document viewers to hand their existing record title to the recorder.

src/components/recent-pages/recent-page-title.tsx

recent-pages-recorder.tsxRecord eligible page opens after titles settle +96/-0

Record eligible page opens after titles settle

• Observes navigation and page-title changes, avoiding stale titles from the previous route. Recording requires the existing recent-searches preference.

src/components/recent-pages/recent-pages-recorder.tsx

use-recent-pages.tsProvide reactive recent-page selections +33/-0

Provide reactive recent-page selections

• Subscribes UI consumers to page history, excludes the current page and uses an empty server snapshot to avoid hydration mismatch.

src/components/recent-pages/use-recent-pages.ts

two-pane-side-menu.cssStyle section labels in two-pane recent rows +11/-0

Style section labels in two-pane recent rows

• Adds subdued, truncated metadata styling for a recent page's section.

src/components/work-frame/two-pane-side-menu.css

two-pane-side-menu.tsxAdd recent pages to both menu panes +60/-1

Add recent pages to both menu panes

• Shows cross-mode page history in the Work and Clinical panes and distinguishes existing recent questions from recent pages.

src/components/work-frame/two-pane-side-menu.tsx

work-search-sheet.tsxShow recent pages in AI Search's empty state +30/-0

Show recent pages in AI Search's empty state

• Adds links to the five latest eligible pages alongside the existing empty-state suggestions.

src/components/work-search/work-search-sheet.tsx

account-scoped-browser-state.tsScope page history to the current account +9/-0

Scope page history to the current account

• Defines the recent-pages storage key and removes it during account-scoped browser-state clearing.

src/lib/account-scoped-browser-state.ts

app-modes.tsShorten DSM and Medication search placeholders +2/-2

Shorten DSM and Medication search placeholders

• Uses shorter placeholder text while retaining the more descriptive accessible input labels.

src/lib/app-modes.ts

recent-pages.tsImplement privacy-filtered local page history +401/-0

Implement privacy-filtered local page history

• Allowlist-checks routes, normalises and expires entries, and stores at most 12 distinct pages without queries. Provides subscriptions, selection and clearing for UI consumers.

src/lib/recent-pages.ts

Tests (6) +459 / -1
mode-home-favourites-group.dom.test.tsxTest mode-specific favourite rows +60/-0

Test mode-specific favourite rows

• Verifies differential and therapy favourite names and links without extra network requests or unrelated catalogue loading.

tests/mode-home-favourites-group.dom.test.tsx

mode-home-start-list.dom.test.tsxTest Clinical home start-list behaviour +82/-0

Test Clinical home start-list behaviour

• Covers eligible modes, empty states, newest-three ordering, reactive updates and placement below the unchanged home.

tests/mode-home-start-list.dom.test.tsx

recent-pages-menus.dom.test.tsxTest recent pages in the phone menu +62/-0

Test recent pages in the phone menu

• Checks empty-state hiding, five-item limits, current-page exclusion and placement under Work areas.

tests/recent-pages-menus.dom.test.tsx

recent-pages-recorder.dom.test.tsxTest document and navigation title capture +88/-0

Test document and navigation title capture

• Verifies document-supplied titles and prevents a new route from being saved under the previous page's title.

tests/recent-pages-recorder.dom.test.tsx

recent-pages.dom.test.tsTest route eligibility and page-history storage +166/-0

Test route eligibility and page-history storage

• Covers sensitive-route exclusions, title parsing, bounded and expiring entries, clearing, account transitions and page selection.

tests/recent-pages.dom.test.ts

ui-smoke.spec.tsUpdate Medication placeholder smoke assertion +1/-1

Update Medication placeholder smoke assertion

• Expects the shortened Medication search placeholder while retaining the existing search-flow check.

tests/ui-smoke.spec.ts

@qodo-code-review

Copy link
Copy Markdown
Contributor

Qodo Fixer

No findings are available for this PR yet. Findings appear here once Qodo has reviewed the PR.

@claude

claude Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error after 2s —— View job


I'll analyze this and get back to you.

Comment thread src/components/mode-home-start-list.tsx Resolved
@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit 78f272a

…or the new page's own title

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mws6schjKQbpCQqQzPMKSL
gitar-bot[bot]
gitar-bot Bot previously approved these changes Oct 12, 2026

@gitar-bot gitar-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gitar has auto-approved this PR (configure)

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit dcc4c09

… recorder loads, so a return visit is never saved under another page's title

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mws6schjKQbpCQqQzPMKSL
gitar-bot[bot]
gitar-bot Bot previously approved these changes Oct 12, 2026

@gitar-bot gitar-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gitar has auto-approved this PR (configure)

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit b61c672

…e fact that the reader moved on

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mws6schjKQbpCQqQzPMKSL
gitar-bot[bot]
gitar-bot Bot previously approved these changes Oct 12, 2026

@gitar-bot gitar-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gitar has auto-approved this PR (configure)

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit 7752fb6

Copy link
Copy Markdown
Owner Author

CodSpeed flags a regression on 7752fb6, but the only change since the previous run (which reported no performance change) is one new test file. None of the benchmarked modules (answer ranking, catalog search, chunking, clinical search, medication entities) are touched by this PR, and CodSpeed itself warns these benchmarks spend significant time in system calls it cannot measure consistently. Treating it as measurement noise, not this PR's; no code change made for it.


Generated by Claude Code

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Auto-fix: 1 check failed on CI infrastructure. View session →

  • CodSpeed Performance Analysis: Infrastructure. The regressed benchmark (medicationEntityMatchesInText) and everything it imports are byte-identical to main, and the PR only changes UI and tests. CodSpeed itself flagged a cross-runtime-environment comparison with heavy system-call time. Locally the benchmark runs at about 0.27 ms per call on the PR head, the same as on main.

@qodo-code-review

qodo-code-review Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

No code changes since the last review — review skipped

Qodo Logo

@gitar-bot gitar-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gitar has auto-approved this PR (configure)

@gitar-bot

gitar-bot Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor
Code Review ✅ Approved 3 closed / 3 findings

🔴 High risk · Persisting clinical page titles and paths in browser storage could expose sensitive browsing history to others using the same device.

Adds a device-only Recent pages list to the Work and Clinical side menus and AI Search, plus Continue, Favourites and Browse all shortcuts on the DSM, Medication, Therapy, Documents and Differentials homes. Resolved the Documents pages not being recorded so Continue never appeared, the recorder saving the previous page's title under a new path, and favourites fetching service and form registries it then discarded. No open findings remain.

✅ 3 closed
✅ Bug: Documents pages are never recorded, so Documents' Continue never appears

📄 src/lib/recent-pages.ts:124 📄 src/lib/recent-pages.ts:206-220 📄 src/components/recent-pages/recent-pages-recorder.tsx:42-46 📄 src/components/mode-home-start-list.tsx:53
/documents/[id]/page.tsx doesn't export metadata, and nothing on the client sets document.title, so the tab title stays at the root layout's BRAND_NAME ("PsychSift"). recentPageTitle treats "psychsift" (and "document"/"document viewer") as a generic title and returns null. As a result recordRecentPage never runs for a document, and the Documents home's "Continue" group and the menu's Recent pages never list one, even though the PR says Documents gets Continue. The unit test only checks recentPageTarget("/documents/abc-123"), which is why this got through. Fix: add a generateMetadata to the document route that returns the document's own title (e.g. ${detail.title} | PsychSift). If the title should not come from the server, set it from the viewer.

✅ Bug: Recorder can save the previous page's title under the new path

📄 src/components/recent-pages/recent-pages-recorder.tsx:35-49
The recorder's first record() runs 400 ms after pathname changes and reads whatever document.title is at that point. Routes like /documents/[id] and /medications/[slug] have loading.tsx and await server data, so the navigation commits (and usePathname updates) before the new route's metadata arrives. For that window the tab still shows the old title, for example "Lithium | PsychSift". The samePath check passes, so /documents/abc gets saved with the title "Lithium". If the new page's title later turns out generic ("PsychSift", "Medication | PsychSift") or never changes, recentPageTitle returns null and the wrong label stays. Continue and Recent pages then show a medicine's name on a link to a different record. Fix: capture document.title when the effect starts and skip recording while the title still equals that value. Only the first record after a cold load should accept it.

✅ Performance: Mode-home favourites fetch services/forms registries it then discards

📄 src/components/mode-home-favourites-group.tsx:23-24
ModeHomeFavouritesGroup calls useSavedRegistryFavourites(). When the account has any saved services or forms, that hook turns on useRegistryRecords("service") and useRegistryRecords("form"), which are network fetches of the registry search view. It also dynamically imports @/lib/therapies whenever therapies are saved. The group then keeps only differentials or therapies items. So each time someone opens the Differentials or Therapy home, it can fire registry requests whose results are thrown away, and the Differentials home loads the therapies module for nothing. Fix: read the needed slugs straight from useAccountData().favourites (differential / therapy), or add a type filter to the hook so it only enables the registries it needs.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Approved

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Counting what did not apply, without listing it.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@gitar-bot
gitar-bot Bot merged commit 2f928bd into main Oct 13, 2026
45 of 46 checks passed
@gitar-bot
gitar-bot Bot deleted the claude/site-clinical-recent-xk2j9i branch October 13, 2026 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔴 Large blast radius size:XXL This PR changes 1000+ lines, ignoring generated files 🕐 40+ Minutes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants