From 0358e7d3315b320e241af6d5e292a3c655f5395a Mon Sep 17 00:00:00 2001 From: Andrei Date: Fri, 3 Oct 2025 12:04:07 +0000 Subject: [PATCH] fix: Resolve HTML nesting errors in DeviceTrustManagement component MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed React hydration warnings caused by invalid HTML nesting in the DeviceTrustManagement component. ## Issues Fixed - Error: "

cannot be a descendant of

" - Error: "

cannot be a descendant of

" - Error: "

cannot contain a nested

" - Error: "

cannot contain a nested

" ## Root Cause The ListItemText component renders its secondary prop as a

tag by default. We were incorrectly nesting Box (

) and Typography (

) components inside the secondary prop, causing invalid HTML structure. ## Solution - Removed nested Box and Typography components from ListItemText props - Used simple text content with
for line breaks in secondary text - Moved chips (Current, Trusted/Untrusted) outside of ListItemText - Positioned chips as separate Box between ListItemText and ListItemSecondaryAction - Maintained visual layout while fixing HTML structure ## Changes - primary: Now just plain text (device.platform) - secondary: Plain text with
separator instead of nested Typography - Chips: Moved to separate Box with flex layout This ensures proper HTML semantics and eliminates hydration errors. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../settings/DeviceTrustManagement.tsx | 52 +++++++++---------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/maternal-web/components/settings/DeviceTrustManagement.tsx b/maternal-web/components/settings/DeviceTrustManagement.tsx index ce3f8fb..8244493 100644 --- a/maternal-web/components/settings/DeviceTrustManagement.tsx +++ b/maternal-web/components/settings/DeviceTrustManagement.tsx @@ -203,37 +203,33 @@ export function DeviceTrustManagement() { {getPlatformIcon(device.platform)} - - {device.platform || 'Unknown Platform'} - - {device.isCurrent && ( - } /> - )} - {device.trusted ? ( - } /> - ) : ( - } - /> - )} - - } + primary={device.platform || 'Unknown Platform'} secondary={ - - - Device: {device.deviceFingerprint} - - - Last seen: {formatDistanceToNow(new Date(device.lastSeen))} ago - - + <> + Device: {device.deviceFingerprint} +
+ Last seen: {formatDistanceToNow(new Date(device.lastSeen))} ago + } + primaryTypographyProps={{ + sx: { display: 'inline', mr: 1 } + }} /> + + {device.isCurrent && ( + } /> + )} + {device.trusted ? ( + } /> + ) : ( + } + /> + )} +