Skip to content

[Wallet] Use DELETE to unlink stellar-address on disconnect and surface errors (#714) - #781

Open
PINYOPATTANAWASANPORN wants to merge 1 commit into
MergeFi:mainfrom
PINYOPATTANAWASANPORN:fix/wallet-disconnect-unlink-714
Open

PINYOPATTANAWASANPORN wants to merge 1 commit into
MergeFi:mainfrom
PINYOPATTANAWASANPORN:fix/wallet-disconnect-unlink-714

Conversation

@PINYOPATTANAWASANPORN

Copy link
Copy Markdown

Summary of Changes

  • Replaces the rejected PATCH /users/:id/stellar-address ({ stellarAddress: null }) with DELETE /users/:id/stellar-address on wallet disconnect.
  • Surfaces unlink errors to the user via updateError instead of swallowing failures silently with .catch(() => {}).
  • Updates unit tests in src/context/WalletContext.test.tsx to verify the DELETE invocation and asserts error display in the UI when unlink fails.

Closes #714. Coordinates with backend #652.

Root Cause / Technical Context

Previously, WalletContext.disconnect() called PATCH /users/:id/stellar-address with { stellarAddress: null }. Because SetStellarAddressDto validates the payload with @IsStellarAddress(), null was rejected with HTTP 400 every time. Swallowing the error left the backend with the old address, which reconnected upon page reload.

Verification & Testing

  • Unit tests in src/context/WalletContext.test.tsx:
    • Verified DELETE /users/user-1/stellar-address is dispatched upon disconnect while signed in.
    • Verified local state still clears synchronously.
    • Verified error state is updated and displayed if the backend unlink request fails.
  • Strict LF line ending normalization and surgical minimal diff.

…ergeFi#714)

- Call DELETE /users/:id/stellar-address on disconnect instead of invalid PATCH null
- Surface unlink failure to user via updateError instead of swallowing
- Update and add unit tests in src/context/WalletContext.test.tsx
@vercel

vercel Bot commented Oct 15, 2026

Copy link
Copy Markdown

@PINYOPATTANAWASANPORN is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wallet 'Disconnect' never sticks: PATCH { stellarAddress: null } always fails validation and the error is swallowed

1 participant