Repository navigation
fix(wallet): reconnect in embedded contexts so widget/Safe don't show 'Connect Wallet' - #7785
tenderdeve wants to merge 1 commit into
Conversation
… "Connect Wallet" cowprotocol#7757 changed `enableReconnect: true` to `enableReconnect: hasRecentConnector`. Embedded contexts — a Safe App iframe, or the injected widget in dapp mode — (re)establish the connection through the host on every load and don't persist a `recentConnectorId`, so reconnect was disabled for them. The account stays empty and the trade form renders a (disabled) "Connect Wallet" while the wallet is actually connected. Also enable reconnect when in a Safe App iframe or injected widget, keeping the `hasRecentConnector` gate for the standalone/mobile path cowprotocol#7757 was guarding.
|
@tenderdeve is attempting to deploy a commit to the cow-dev Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughIn libs/wallet/src/wagmi/config.ts, a new ChangesReconnect condition update
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Cloudflare Pages preview mirror Preview branch URL: https://github.com/cowprotocol/cowswap/tree/cf-preview/pr-7785 Source fork branch:
|
elena-zh
left a comment
There was a problem hiding this comment.
Hey @tenderdeve , thank you for the attempt to address this issue.
However, it does not work as expected:
- It is impossible to connect the app inside MM integrated browser now (it was fixed in #7757
- the widget connection inside Safe is not isolated: when I open just widget, and connect to a wallet there, the connection is reset inside Safe, and it shows MM connection instead of Safe one.
|
Thanks @elena-zh — you're right, and both regressions come from the same root cause in my approach. Forcing
So blanket-broadening Before I re-push I want to get the intended behavior right rather than guess again, since I can't reproduce the MM-mobile / Safe-in-widget cases locally. Two questions:
cc @fairlighteth since this borders on #7757. |
|
Hey @tenderdeve , thank you. No need to work further on this PR since we're fixing the issue by ourselves in #7790 |
Fixes #7777
@elena-zh confirmed this regressed in #7757, which changed
enableReconnect: true→enableReconnect: hasRecentConnector.Embedded contexts — a Safe App iframe, or the injected widget in dapp mode — (re)establish the connection through the host on every load and don't persist a
recentConnectorId. So reconnect is now disabled for them: the account stays empty and the trade form renders a (disabled) "Connect Wallet" while the wallet is actually connected.Fix: also enable reconnect when in a Safe App iframe or injected widget, keeping the
hasRecentConnectorgate for the standalone/mobile path #7757 was guarding.Repro (from the issue): open a Safe App pointing at the widget —
https://app.safe.global/apps/open?safe=<your_safe>&appUrl=https%3A%2F%2Fdev.widget.cow.fi.@fairlighteth since this touches the
enableReconnectgate you added in #7757 — this keeps your mobile-injected guard intact and only restores reconnect for the Safe-app / injected-widget contexts. Does that look right to you?Summary by CodeRabbit