Repository navigation
fix: wallet disconnect calls DELETE instead of PATCH { stellarAddress: null } (#714) - #819
Merged
Merged
Conversation
…ink (#714) PATCH { stellarAddress: null } was always rejected with 400 by the backend because @IsStellarAddress() only accepts a valid Stellar Ed25519 public key. The .catch(() => {}) silently discarded the error, so AuthUser.stellarAddress remained set on the backend even though the local UI showed "disconnected". Changes: - Call DELETE /users/:id/stellar-address instead of PATCH with null body. - Replace the silent .catch(() => {}) with a console.error so backend unlink failures are visible in devtools without blocking the local disconnect flow.
#714) The assertion that checked for PATCH { stellarAddress: null } would have started failing after the WalletContext change. Updated to assert the DELETE method with no body, matching the new backend route.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #714
Root cause:
disconnect()calledPATCH /users/:id/stellar-addresswith{ stellarAddress: null }. The backend's@IsStellarAddress()validator runsStrKey.isValidEd25519PublicKey(null)→false→400 Bad Request. The.catch(() => {})silently discarded the failure, soAuthUser.stellarAddressstayed set on the backend while the UI appeared disconnected. Every "Disconnect" click was a no-op on the server.Fix (frontend — this PR):
disconnect()now callsDELETE /users/:id/stellar-address(no body), which maps to the new dedicated unlink route added in the companion backend PR [fix: wallet disconnect fails silently — add DELETE /users/:id/stellar-address (#714) backend#718]..catch(() => {})withconsole.error(...)so backend unlink failures are visible in devtools. The local disconnect (UI + localStorage) still completes synchronously regardless, so the UI is never lying about local state.WalletContexttest that assertedPATCH { stellarAddress: null }to assertDELETEinstead.Backend companion PR: MergeFi/backend#718
Test plan
npm test— updatedWalletContextdisconnect test passes; no other test regressionsAuthUser.stellarAddressis null in the database after the callDELETE /users/:id/stellar-address→ 200 on disconnect