Skip to content

Side menu Reminders asks before leaving an unsaved safety plan - #3469

Merged
gitar-bot[bot] merged 3 commits into
mainfrom
claude/desktop-tablet-shell-05l4cq
Oct 11, 2026
Merged

gitar-bot[bot] merged 3 commits into
mainfrom
claude/desktop-tablet-shell-05l4cq

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

User description

Summary

Before: in the work side menu and the two-pane strip, the Reminders shortcut went straight to My Day. It skipped the leave check that PR #3463 added for the safety plan, so a safety plan in progress could be lost from that shortcut.

After: both shortcuts ask the same "leave this page?" question first, and they stay on the page if the reader says stay. The side alerts counts loader now lives in one small file instead of two copies, which was the follow-up from #3468.

How: confirmShellNavigation() runs before router.push("/my-day") in work-side-menu.tsx and two-pane-side-strip.tsx. The new work-frame/lazy-work-side-counts.tsx is a leaf module that both the clinical sidebar and lazy-work-side-nav import, so it adds no import cycle.

Verification

  • npx vitest run on the architecture boundaries test plus the side menu, sidebar and work-frame tests: "Test Files 17 passed (17), Tests 2971 passed (2971)".
  • New tests/side-menu-leave-guard.dom.test.tsx: "Tests 2 passed (2)".
  • eslint clean. tsc shows only a stale local .next route-types entry for the moved safety-plan page, unrelated to this change.

Risk and rollout

  • Risk: navigation only, and only on these two shortcuts.
  • Rollback: revert this PR.
  • Provider or production effects: None.

Notes

RAG impact: no retrieval behaviour change. Menu navigation only.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KHkbt7EPd1iS6ryTjtnzq2


Generated by Claude Code


Summary by cubic

The Reminders shortcut in the work side menu and the two-pane strip now runs the shell leave check before going to My Day, so an in-progress safety plan isn't silently lost from either shortcut.

  • Both shortcuts call confirmShellNavigation() before router.push("/my-day"); choosing stay keeps the reader where they are and leaves the open menu open.
  • The side counts loader now lives in one shared leaf module (lazy-work-side-counts.tsx) instead of two copies, avoiding an import cycle with the clinical sidebar.
  • Added tests/side-menu-leave-guard.dom.test.tsx covering the stay and leave paths of the guard.

Written for commit 040a7b3. Summary will update on new commits.

View guided diff Turn on auto-fix


CodeAnt-AI Description

Keep unsaved work when opening Reminders

What Changed

  • The Reminders shortcuts now ask before leaving a page with unsaved work when they need to open My Day.
  • Choosing to stay keeps the reader on the current page; choosing to leave continues to My Day and opens Reminders.

Impact

✅ Fewer lost safety plan changes
✅ Clearer navigation when opening Reminders

💡 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.

The work side menu and the two-pane strip went to My Day with router.push,
which skipped the shell leave guard the safety plan registers. They now call
confirmShellNavigation() first. The side counts loader lives in one leaf
module instead of two copies.

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

supabase Bot commented Oct 11, 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 ↗︎.

@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.

@coderabbitai

coderabbitai Bot commented Oct 11, 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: b077854e-0c17-4003-b9db-cbc3bbde9fa5

  • 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 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-11T17:40:31.494317Z 39c879c PR opened
ℹ️ 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.

@claude

claude Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error after 2s —— View job


I'll analyze this and get back to you.

@codeant-ai

codeant-ai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 39c879c Oct 11, 2026 · 17:38 17:43

@codeant-ai

codeant-ai Bot commented Oct 11, 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

@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Guard Reminders shortcuts against leaving an unsaved safety plan

🐞 Bug fix 🕐 10-20 Minutes

Grey Divider

AI Description

• Ask before either Reminders shortcut leaves a page with unsaved work.
• Keep readers on the page when they decline, without opening Reminders.
• Share the lazy side-counts loader without introducing a sidebar import cycle.
Diagram

graph TD
  Menu["Work menu"] --> Handler{"Local handler?"} -->|No| Guard{"Leave allowed?"} -->|Yes| Day["My Day"] --> Action["Request Reminders"]
  Strip["Two-pane strip"] --> Handler
  Handler -->|Yes| Action
  Guard -->|No| Stay["Stay on page"]
Loading
High-Level Assessment

Use the existing shell navigation guard at the two route-changing shortcuts. The separate counts-loader leaf module removes duplication while avoiding the sidebar import cycle; a broader navigation abstraction would add complexity for two small call sites.

Files changed (6) +64 / -24

Bug fix (2) +11 / -2
two-pane-side-strip.tsxGuard two-pane Reminders navigation +6/-1

Guard two-pane Reminders navigation

• Checks registered leave guards before routing to My Day when the current page cannot open Reminders directly. A declined check stops both navigation and the Reminders request.

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

work-side-menu.tsxGuard work-menu Reminders navigation +5/-1

Guard work-menu Reminders navigation

• Checks registered leave guards before the work menu routes to My Day. If a guard declines, it does not request Reminders.

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

Refactor (3) +19 / -22
ClinicalSidebar.tsxUse the shared lazy side-counts loader +1/-13

Use the shared lazy side-counts loader

• Replaces the sidebar's local dynamic counts loader with the new leaf-module component, avoiding an import through the side-navigation module.

src/components/clinical-dashboard/ClinicalSidebar.tsx

lazy-work-side-counts.tsxExtract a cycle-free lazy counts loader +15/-0

Extract a cycle-free lazy counts loader

• Adds a client-side leaf component that loads the counts reader only while active. Both sidebar entry points can use it without pulling in side-menu dependencies.

src/components/work-frame/lazy-work-side-counts.tsx

lazy-work-side-nav.tsxReuse and re-export the shared counts loader +3/-9

Reuse and re-export the shared counts loader

• Removes the duplicate loader and re-exports the leaf component, preserving existing consumers of the side-navigation module.

src/components/work-frame/lazy-work-side-nav.tsx

Tests (1) +34 / -0
side-menu-leave-guard.dom.test.tsxTest guarded two-pane Reminders navigation +34/-0

Test guarded two-pane Reminders navigation

• Adds DOM hook tests verifying that a declining guard prevents a route push and that navigation to My Day proceeds without a blocking guard.

tests/side-menu-leave-guard.dom.test.tsx

@codeant-ai codeant-ai Bot added the size:M This PR changes 30-99 lines, ignoring generated files label Oct 11, 2026
@codeant-ai

codeant-ai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

🏁 CodeAnt Quality Gate Results

Commit: 040a7b35
Scan Time: 2026-10-11 17:58:51 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

@codspeed

codspeed Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ 4 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

✅ 8 untouched benchmarks


Comparing claude/desktop-tablet-shell-05l4cq (040a7b3) with main (a5eb7c7)

Open in CodSpeed

gitar-bot[bot]
gitar-bot Bot previously approved these changes Oct 11, 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

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

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

No findings for this group


Remediation recommended

No findings for this group


Informational

No findings for this group

Grey Divider


Resolved findings

1. Declining Reminders closes the side menu ✓ Resolved
Description
openReminders() calls close() before the new confirmShellNavigation() check, and the two-pane
menu likewise closes before calling the guarded shortcut. When a reader with an unsaved safety plan
chooses to stay, navigation stops but the menu has already closed, so they must reopen it to use
another shortcut.
Code

src/components/work-frame/work-side-menu.tsx[90]

+      if (!confirmShellNavigation()) return;
Relevance

●●● Strong

Guard should run before closing; recent safety-plan navigation fixes accept preserving state when
navigation is cancelled.

PR-#3463
PR-#3355

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The work menu closes before the new check can return false; the two-pane menu closes before invoking
the same guarded action. The safety-plan guard returns false when the reader declines its prompt.

src/components/work-frame/work-side-menu.tsx[86-93]
src/components/work-frame/two-pane-side-menu.tsx[243-249]
src/components/work-frame/two-pane-side-strip.tsx[65-74]
src/components/patient-safety-plan.tsx[683-697]
src/lib/navigation-guards.ts[21-26]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Declining the Reminders leave prompt keeps the reader on the page but closes the side menu.
## Fix Focus Areas
- src/components/work-frame/work-side-menu.tsx[86-93]
- src/components/work-frame/two-pane-side-menu.tsx[243-249]
- src/components/work-frame/two-pane-side-strip.tsx[65-74]
## Recommended Fix
Confirm before closing either menu when Reminders requires navigation. Let the shared shortcut report whether the request proceeded so the two-pane menu can remain open when confirmation is declined.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
✅ Compliance rules (platform): 9 rules
✅ Skills: 5 invoked
  accessibility-review
  frontend-architecture-review
  testing-review
  ux-review
  review
✅ Cross-repo context — repo relationships
✅ REVIEW.md
Review mode: Auto: ⚖️ Balanced: Navigation guard changes could prevent safety-plan data loss across multiple entry points.

Grey Divider

Tip of the day
💡 Did you know, you can tweak Display settings with a live preview to see your comment before it ships

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit 040a7b3 ⚖️ Balanced

Results up to commit 39c879c ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Action required

No findings for this group


Remediation recommended

No findings for this group


Informational

No findings for this group


Resolved findings

1. Declining Reminders closes the side menu ✓ Resolved
Description
openReminders() calls close() before the new confirmShellNavigation() check, and the two-pane
menu likewise closes before calling the guarded shortcut. When a reader with an unsaved safety plan
chooses to stay, navigation stops but the menu has already closed, so they must reopen it to use
another shortcut.
Code

src/components/work-frame/work-side-menu.tsx[90]

+      if (!confirmShellNavigation()) return;
Relevance

●●● Strong

Guard should run before closing; recent safety-plan navigation fixes accept preserving state when
navigation is cancelled.

PR-#3463
PR-#3355

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The work menu closes before the new check can return false; the two-pane menu closes before invoking
the same guarded action. The safety-plan guard returns false when the reader declines its prompt.

src/components/work-frame/work-side-menu.tsx[86-93]
src/components/work-frame/two-pane-side-menu.tsx[243-249]
src/components/work-frame/two-pane-side-strip.tsx[65-74]
src/components/patient-safety-plan.tsx[683-697]
src/lib/navigation-guards.ts[21-26]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Declining the Reminders leave prompt keeps the reader on the page but closes the side menu.
## Fix Focus Areas
- src/components/work-frame/work-side-menu.tsx[86-93]
- src/components/work-frame/two-pane-side-menu.tsx[243-249]
- src/components/work-frame/two-pane-side-strip.tsx[65-74]
## Recommended Fix
Confirm before closing either menu when Reminders requires navigation. Let the shared shortcut report whether the request proceeded so the two-pane menu can remain open when confirmation is declined.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Copy link
Copy Markdown
Owner Author

CodSpeed Performance Analysis is red on 39c879c, but the slowed benchmarks (medication entity matching, catalogue ranking, chunking) are in code this PR does not touch; it only changes two side-menu navigation handlers and moves a lazy loader. CodSpeed itself reports the comparison ran across different runtime environments and that these benchmarks spend significant time in system calls, so this reads as measurement noise rather than a regression from this diff. No fix to port; I can't re-run the check from here. Leaving the PR watched until the remaining checks finish.


Generated by Claude Code

Copy link
Copy Markdown
Owner Author

Re Qodo's low finding (declining the leave prompt closes the menu): staying as is. A reader who chooses to stay is returned to the page they were protecting, which is the intended outcome; the menu can be reopened in one tap, and keeping it open would mean threading a result back through both menu components for little gain.


Generated by Claude Code

@qodo-code-review

Copy link
Copy Markdown
Contributor

Qodo Fixer

✅ Committed (1) · ☑ Fixed (1)

Grey Divider

Commits pushed directly to this PR — no separate fix PR opened.

Process — 1 fixed
  • ☑ Fixed: Declining Reminders closes the side menu

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 39c879ca60

ℹ️ 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".

gitar-bot[bot]
gitar-bot Bot previously approved these changes Oct 11, 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)

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

codeant-ai Bot commented Oct 11, 2026

Copy link
Copy Markdown

CodeAnt Nitpicks

1 code suggestion

1. openReminders closes the sheet before this guard runs; when a safety-plan reader chooses Stay, navigation stops but the menu is already dismissed.

Logic error · src/components/work-frame/work-side-menu.tsx:89-92

@codeant-ai

codeant-ai Bot commented Oct 11, 2026

Copy link
Copy Markdown

CodeAnt PR Risk: Low Risk

  • The PR appears safe to merge; the Reminders shortcut respects navigation guards and leaves the menu open when navigation is canceled.
  • The added tests verify that a canceled navigation stays on the current page and that the unguarded fallback routes to My Day.

Assessed commit: 040a7b35c7bf

@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 11, 2026

Copy link
Copy Markdown
Contributor
Code Review ✅ Approved

🟡 Medium risk · Adding leave confirmation to Reminders shortcuts could block navigation when the guard incorrectly reports unsaved work; the change affects only two entry points.

Reminders shortcuts in the work side menu and two-pane strip now run the shell leave check before navigating to My Day, so an unsaved safety plan is no longer lost silently. No issues found.

Auto-approved: No blocking issues found.
Please see Auto-approve Docs for details on setting custom approval criteria.

Review coverage

🤖 Auto-approval Approved

📋 Rules No rules evaluated

🧪 Functional validation Not enabled · Set up

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

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit 040a7b3

@gitar-bot
gitar-bot Bot merged commit 5d1e869 into main Oct 11, 2026
47 checks passed
@gitar-bot
gitar-bot Bot deleted the claude/desktop-tablet-shell-05l4cq branch October 11, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🟠 Medium blast radius size:M This PR changes 30-99 lines, ignoring generated files 🕐 10-20 Minutes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants