Fix voice command status transitions and UI bugs
Some checks failed
CI/CD Pipeline / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Application (push) Has been cancelled

Fixed multiple issues with voice command workflow:

**Status Transition Fixes:**
- Fixed infinite loop in status update useEffect by checking if status actually needs to change
- Status now properly transitions: listening → understanding → review/close
- Added debug logging to track status changes

**UI Bug Fixes:**
- Fixed crash in diaper tracker when conditions field is undefined (voice-created activities)
- Auto-close dialog when classification returns "unknown" type
- Added optional chaining for conditions.join() in getDiaperDetails

**Changes:**
- VoiceFloatingButton: Prevent setting same status repeatedly
- VoiceFloatingButton: Close dialog on unknown classification
- Diaper page: Handle missing conditions field gracefully

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-02 11:17:55 +00:00
parent e94a1018c4
commit a813a36cea
2 changed files with 15 additions and 7 deletions

View File

@@ -331,9 +331,12 @@ export default function DiaperTrackPage() {
const getDiaperDetails = (activity: Activity) => {
const data = activity.data as DiaperData;
const typeLabel = data.diaperType.charAt(0).toUpperCase() + data.diaperType.slice(1);
const conditionsLabel = data.conditions.join(', ');
const conditionsLabel = data.conditions?.join(', ') || '';
let details = `${typeLabel} - ${conditionsLabel}`;
let details = typeLabel;
if (conditionsLabel) {
details += ` - ${conditionsLabel}`;
}
if (data.hasRash) {
details += ` - Rash (${data.rashSeverity})`;