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) <noreply@anthropic.com>
This commit is contained in:
parent
086650c88a
commit
c301b25450
2 changed files with 10 additions and 2 deletions
|
|
@ -39,7 +39,11 @@ export default function ProfileSwitcher() {
|
|||
const handlePinSuccess = async (rehashed?: string | null) => {
|
||||
if (pinProfile) {
|
||||
if (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);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,11 @@ export default function ProfileSelectionPage() {
|
|||
const handlePinSuccess = async (rehashed?: string | null) => {
|
||||
if (pinProfileId) {
|
||||
if (rehashed) {
|
||||
try {
|
||||
await updateProfile(pinProfileId, { pin_hash: rehashed });
|
||||
} catch {
|
||||
// Best-effort rehash: don't block profile switch if persistence fails
|
||||
}
|
||||
}
|
||||
switchProfile(pinProfileId);
|
||||
setPinProfileId(null);
|
||||
|
|
|
|||
Loading…
Reference in a new issue