Side menu Reminders asks before leaving an unsaved safety plan

Merged
BI
1mo ago
+69-27

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.

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.