refactor(mockup): scope safety-plan id counter per instance - #1037
Conversation
Replace the module-level mutable `seq` counter behind `uid()` with a per-instance `useRef` counter inside PatientSafetyPlanMockup. The old module-level counter kept incrementing across unmount/remount (route revisits); a per-instance ref resets with the component. Ids only need to be unique within a mounted plan, so behaviour is unchanged. `uid` is a stable useCallback and is added to `addEntry`'s dependency list. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019g9m5emoPKCmDDPeGrchYd
This pull request has been ignored for the connected project Preview Branches by Supabase. |
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe patient safety plan mockup replaces its module-level ID sequence with an instance-scoped ChangesPatient safety plan ID generation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Uh oh!
There was an error while loading. Please reload this page.
Summary
seqcounter behinduid().useRefcounter insidePatientSafetyPlanMockup. The old module-level counter kept incrementing across unmount/remount (route revisits); a per-instance ref resets with the component. Ids only need to be unique within a mounted plan, so behaviour is unchanged.uidis now a stableuseCallbackand is added toaddEntry's dependency list (satisfiesreact-hooks/exhaustive-deps).Scope: one file, dev-only mockup (
/mockups/patient-safety-plan, 404 in production).Verification
tsc --noEmit) — cleanreact-hooks/exhaustive-deps— cleaneval:*,check:production-readiness,verify:uiRisk and rollout
Clinical Governance Preflight
Refactor of internal id generation in a dev-only mockup; no ingestion, answer generation, retrieval/ranking, source rendering, document-access, privacy, production-env, or clinical-output behaviour is touched — all items below hold unchanged.
Clinical KB Database(sjrfecxgysukkwxsowpy)Notes
🤖 Generated with Claude Code
https://claude.ai/code/session_019g9m5emoPKCmDDPeGrchYd
Generated by Claude Code
Summary by CodeRabbit