From e5be6f5a56de22b80d9a78e0759d6f239a8149b9 Mon Sep 17 00:00:00 2001 From: escouade-bot Date: Thu, 9 Apr 2026 08:01:08 -0400 Subject: [PATCH] fix: wrap rehash updateProfile in try/catch for best-effort (#54) Both handlePinSuccess handlers (ProfileSwitcher and ProfileSelectionPage) now catch updateProfile errors so that a failed rehash persistence does not block switchProfile. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/components/profile/ProfileSwitcher.tsx | 6 +++++- src/pages/ProfileSelectionPage.tsx | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/profile/ProfileSwitcher.tsx b/src/components/profile/ProfileSwitcher.tsx index 1c0ae74..d92f082 100644 --- a/src/components/profile/ProfileSwitcher.tsx +++ b/src/components/profile/ProfileSwitcher.tsx @@ -39,7 +39,11 @@ export default function ProfileSwitcher() { const handlePinSuccess = async (rehashed?: string | null) => { if (pinProfile) { if (rehashed) { - await updateProfile(pinProfile.id, { pin_hash: rehashed }); + try { + await updateProfile(pinProfile.id, { pin_hash: rehashed }); + } catch { + // Best-effort rehash: don't block profile switch if persistence fails + } } switchProfile(pinProfile.id); setPinProfile(null); diff --git a/src/pages/ProfileSelectionPage.tsx b/src/pages/ProfileSelectionPage.tsx index d76cbf6..b62f7ca 100644 --- a/src/pages/ProfileSelectionPage.tsx +++ b/src/pages/ProfileSelectionPage.tsx @@ -26,7 +26,11 @@ export default function ProfileSelectionPage() { const handlePinSuccess = async (rehashed?: string | null) => { if (pinProfileId) { if (rehashed) { - await updateProfile(pinProfileId, { pin_hash: rehashed }); + try { + await updateProfile(pinProfileId, { pin_hash: rehashed }); + } catch { + // Best-effort rehash: don't block profile switch if persistence fails + } } switchProfile(pinProfileId); setPinProfileId(null);