fix: rebuild safe information-page back navigation#1161
Conversation
Replace legacy sm:h-11/sm:w-11 classes with IconButton size-tap, and mock next/navigation in privacy/safety-plan tests that render without App Router. Co-authored-by: Cursor <cursoragent@cursor.com>
Always push fallbackHref instead of history.back() so external referrers cannot eject users from Clinical KB. Settings back uses IconButton/size-tap. Addresses Codex review on PR #1121. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Guard the header back control when entries, reasons, or a plan date have been edited so in-progress browser-only content is not discarded without confirmation.
Cancel pending focus-restore rAF/timeouts on Sheet unmount and guard document access so Vitest coverage workers cannot fail the suite with an unhandled ReferenceError after document-viewer shell tests open a sheet.
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
📝 WalkthroughWalkthroughAdds deterministic back navigation and privacy return links, protects safety-plan drafts with confirmation prompts, adds a settings back control, and hardens Sheet focus restoration during teardown with expanded tests. ChangesNavigation and lifecycle hardening
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant PrivacyInputNotice
participant PrivacyPage
participant PrivacyPageBackButton
participant NextRouter
PrivacyInputNotice->>PrivacyPage: open /privacy?from=mode
PrivacyPage->>PrivacyPageBackButton: render back control
PrivacyPageBackButton->>NextRouter: push allowlisted mode home or /
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 004e191ee4
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
# Conflicts: # src/components/ui/sheet.tsx Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
…-clean-reconciliation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eef0634016
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex resolve actionable Codex review findings for this pull request and current head using the repository instructions. This is the pull request's single automatic repair pass: do not perform a fresh review, create new standalone findings, or request another review. Work only the existing unresolved Codex threads on the current head. Always fix P0 and P1 findings. For P2 and lower findings, fix only clear, scoped, low-risk issues; otherwise disposition them with a concise reason. After fixing or dispositioning a thread, reply in that thread with as the first line, followed by a concise summary; that marker authorizes the workflow to close that exact thread. If human input or new authorization is required, do not use the marker and leave the thread open with the blocker. Finish only after every actionable thread is fixed or dispositioned and closed, or explicitly left open for a human decision. Do not update the branch from main, address unrelated reviews, broaden scope, or create more than one scoped fix commit. Do not use external APIs, paid services, credentials, dependency changes, or broad refactors unless explicitly authorized. Add targeted tests where behavior changes and run the narrowest relevant validation. |
…-clean-reconciliation
Summary
Testing
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ccc978e2a4
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b2a10590be
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 605264ad6e
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/clinical-dashboard/settings-dialog.tsx`:
- Around line 264-275: Add the lg:hidden responsive utility to the backButton
IconButton in the settings dialog, preserving its mobile visibility and existing
styling while hiding it at desktop breakpoints alongside the close button.
In `@tests/privacy-ui.test.ts`:
- Around line 8-13: Extend the `next/navigation` mock used by `PrivacyPage`
tests to provide a `useSearchParams` implementation alongside `useRouter`.
Ensure the mocked hook returns the search-params interface consumed by
`PrivacyPageBackButton`, while preserving the existing `back` and `push` router
mocks.
In `@tests/sheet.dom.test.tsx`:
- Around line 115-118: Update the unmount timer test around restoreFrameSpy so
it verifies restoreFrameSpy was not called after await vi.runAllTimersAsync(),
not only before the flush. Keep the timer-count assertion, and add or move the
no-call assertion to cover callbacks scheduled during timer processing.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: e4e954b1-921f-4699-88b8-f5084391826a
📒 Files selected for processing (15)
src/app/privacy/page.tsxsrc/app/reference/colour-coding/page.tsxsrc/components/clinical-dashboard/DocumentManagerPanel.tsxsrc/components/clinical-dashboard/master-search-header.tsxsrc/components/clinical-dashboard/settings-dialog.tsxsrc/components/navigation-back-button.tsxsrc/components/patient-safety-plan.tsxsrc/components/privacy-input-notice.tsxsrc/components/privacy-page-back-button.tsxsrc/components/ui/sheet.tsxtests/document-viewer-shell.dom.test.tsxtests/navigation-back-button.dom.test.tsxtests/patient-safety-plan-privacy.dom.test.tsxtests/privacy-ui.test.tstests/sheet.dom.test.tsx
Summary
origin/main, excluding the archived dirty branch ancestry.RAG impact: no retrieval behaviour change — navigation, local dirty-form confirmation, and UI focus teardown only.
Verification
npm run test -- tests/navigation-back-button.dom.test.tsx tests/patient-safety-plan-privacy.dom.test.tsx tests/privacy-ui.test.ts tests/sheet.dom.test.tsx tests/document-viewer-shell.dom.test.tsx— 5 files, 22 tests passed on the current functional head.npm run test -- tests/route-reachability.test.ts tests/navigation-back-button.dom.test.tsx tests/privacy-ui.test.ts— 3 files, 12 tests passed after the privacy-return update; this caught and verified the static reachability fix.npx prettier --checkon the changed navigation/privacy files — passed.npm run test -- tests/privacy-ui.test.ts tests/sheet.dom.test.tsx tests/settings-dialog-actions.dom.test.tsx tests/settings-inert-preferences.dom.test.tsx— 4 files, 16 tests passed after the final review fixes.git diff --check— passed.npm run verify:pr-local; the earlierverify:cheapattempt exceeded the five-minute tool window and lost its final result when the output pipe closed. Protected hosted checks are the broad gate.npm run verify:release; no release/handoff confidence claim is made by this PR alone.Risk and rollout
history.back()behavior is introduced.Clinical Governance Preflight
Clinical KB Database(sjrfecxgysukkwxsowpy).Notes
Summary by CodeRabbit
New Features
Bug Fixes
Tests