Conversation
…form layout, guard submit - Remove duplicate status icons from policy criteria list (keep left icon box, replace right icons with compact text badge) - Rename 'PA Form Data' to 'Clinical Details' and remove redundant Patient Name, DOB, Member ID fields already shown in Patient Information card - Disable submit button when request is still in draft status or clinical summary is empty — shows 'Process request before submitting' message - Show 'Awaiting AI analysis' state in confidence panel for draft requests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This stack of pull requests is managed by Graphite. Learn more about stacking. |
📝 WalkthroughWalkthroughA refactor of the analysis page consolidating UI components and submission logic. Changes include: import simplification, replacing individual status icons with a compact badge, introducing Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/dashboard/src/routes/analysis`.$transactionId.tsx:
- Around line 602-605: The top submit button currently uses the same label
regardless of disabled state; update the button rendering in the component that
uses onClick={handleSubmit} and disabled={!canSubmit || isSubmitting ||
showSubmissionOverlay} so that when !canSubmit (or when disabled for the same
conditions) its visible label mirrors the sidebar guidance (e.g., "Process
request before submitting") or add an accessible tooltip/aria-describedby
explaining the reason; ensure you reference the same props/flags (canSubmit,
isSubmitting, showSubmissionOverlay) and keep the existing click/disabled logic
and styling while only changing the displayed text or adding a tooltip/aria
attribute for accessibility.
- Around line 456-457: handleSubmit isn't protected by the new canSubmit guard
and can be invoked programmatically; update the handleSubmit function to
early-return when !canSubmit or when isSubmittingRef.current is true, then set
isSubmittingRef.current = true and call setShowSubmissionOverlay(true) only
after passing the guard (refer to canSubmit, handleSubmit, isSubmittingRef, and
setShowSubmissionOverlay to locate the change).
- Around line 694-704: The current onChange handler for EditableField (label
"Diagnosis Code") uses v.split(' - ') which loses parts when the diagnosis
contains the delimiter and clears fields if only one side is typed; change the
parse to split only once (e.g., find the first ' - ' and take left part as
diagnosisCode and the rest as diagnosis) so you preserve any additional hyphens
and avoid clearing the second field, then call setEditedData(...) with
diagnosisCode and diagnosis derived from that single-split logic (refer to the
EditableField onChange, setEditedData, and displayData.diagnosisCode/diagnosis
symbols).
| const canSubmit = effectiveRequest.status !== 'draft' && !!effectiveRequest.clinicalSummary?.trim(); | ||
|
|
There was a problem hiding this comment.
Guard handleSubmit with canSubmit.
Line 456 introduces the new gate, but handleSubmit can still be triggered programmatically even when canSubmit is false. Add an early return to enforce the gate in code, not just UI.
✅ Suggested guard near handleSubmit
const handleSubmit = () => {
if (!canSubmit || isSubmittingRef.current) return;
isSubmittingRef.current = true;
setShowSubmissionOverlay(true);
};🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/dashboard/src/routes/analysis`.$transactionId.tsx around lines 456 -
457, handleSubmit isn't protected by the new canSubmit guard and can be invoked
programmatically; update the handleSubmit function to early-return when
!canSubmit or when isSubmittingRef.current is true, then set
isSubmittingRef.current = true and call setShowSubmissionOverlay(true) only
after passing the guard (refer to canSubmit, handleSubmit, isSubmittingRef, and
setShowSubmissionOverlay to locate the change).
| onClick={handleSubmit} | ||
| disabled={isSubmitting || showSubmissionOverlay} | ||
| className="px-5 py-2.5 text-sm font-semibold bg-teal text-white rounded-xl hover:bg-teal/90 disabled:opacity-70 transition-all shadow-teal flex items-center gap-2 min-w-[160px] justify-center click-effect-primary" | ||
| disabled={!canSubmit || isSubmitting || showSubmissionOverlay} | ||
| className="px-5 py-2.5 text-sm font-semibold bg-teal text-white rounded-xl hover:bg-teal/90 disabled:opacity-50 disabled:cursor-not-allowed transition-all shadow-teal flex items-center gap-2 min-w-[160px] justify-center click-effect-primary" | ||
| > |
There was a problem hiding this comment.
Disabled header submit button lacks a reason.
Line 603 disables the top submit button but keeps the label “Confirm & Submit,” which is inconsistent with the sidebar’s explicit guidance. Consider mirroring the “Process request before submitting” message or adding a tooltip.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/dashboard/src/routes/analysis`.$transactionId.tsx around lines 602 -
605, The top submit button currently uses the same label regardless of disabled
state; update the button rendering in the component that uses
onClick={handleSubmit} and disabled={!canSubmit || isSubmitting ||
showSubmissionOverlay} so that when !canSubmit (or when disabled for the same
conditions) its visible label mirrors the sidebar guidance (e.g., "Process
request before submitting") or add an accessible tooltip/aria-describedby
explaining the reason; ensure you reference the same props/flags (canSubmit,
isSubmitting, showSubmissionOverlay) and keep the existing click/disabled logic
and styling while only changing the displayed text or adding a tooltip/aria
attribute for accessibility.
| <EditableField | ||
| label="Diagnosis Code" | ||
| value={`${displayData.diagnosisCode} - ${displayData.diagnosis}`} | ||
| onChange={(v) => { | ||
| const parts = v.split(' - '); | ||
| setEditedData({ | ||
| ...editedData, | ||
| setEditedData({ | ||
| ...editedData, | ||
| diagnosisCode: parts[0] || '', | ||
| diagnosis: parts[1] || '' | ||
| }); | ||
| }} |
There was a problem hiding this comment.
Avoid lossy split for Diagnosis Code.
Line 698 splits on ' - ', which truncates diagnoses that contain the delimiter and clears the second field when users type only one side. Split once and preserve the rest.
🔧 Safer parse to preserve hyphens
- const parts = v.split(' - ');
- setEditedData({
- ...editedData,
- diagnosisCode: parts[0] || '',
- diagnosis: parts[1] || ''
- });
+ const [code, ...rest] = v.split(' - ');
+ setEditedData({
+ ...editedData,
+ diagnosisCode: (code ?? '').trim(),
+ diagnosis: rest.join(' - ').trim()
+ });📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <EditableField | |
| label="Diagnosis Code" | |
| value={`${displayData.diagnosisCode} - ${displayData.diagnosis}`} | |
| onChange={(v) => { | |
| const parts = v.split(' - '); | |
| setEditedData({ | |
| ...editedData, | |
| setEditedData({ | |
| ...editedData, | |
| diagnosisCode: parts[0] || '', | |
| diagnosis: parts[1] || '' | |
| }); | |
| }} | |
| <EditableField | |
| label="Diagnosis Code" | |
| value={`${displayData.diagnosisCode} - ${displayData.diagnosis}`} | |
| onChange={(v) => { | |
| const [code, ...rest] = v.split(' - '); | |
| setEditedData({ | |
| ...editedData, | |
| diagnosisCode: (code ?? '').trim(), | |
| diagnosis: rest.join(' - ').trim() | |
| }); | |
| }} |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/dashboard/src/routes/analysis`.$transactionId.tsx around lines 694 -
704, The current onChange handler for EditableField (label "Diagnosis Code")
uses v.split(' - ') which loses parts when the diagnosis contains the delimiter
and clears fields if only one side is typed; change the parse to split only once
(e.g., find the first ' - ' and take left part as diagnosisCode and the rest as
diagnosis) so you preserve any additional hyphens and avoid clearing the second
field, then call setEditedData(...) with diagnosisCode and diagnosis derived
from that single-split logic (refer to the EditableField onChange,
setEditedData, and displayData.diagnosisCode/diagnosis symbols).

replace right icons with compact text badge)
Name, DOB, Member ID fields already shown in Patient Information card
summary is empty — shows 'Process request before submitting' message
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com