File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed
advanced/wallets/react-wallet-v2/src Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -35,12 +35,11 @@ export default function DeepLinkPairingPage() {
3535 } , [ state . view ] )
3636
3737 useEffect ( ( ) => {
38- if ( requestId ) {
39- ModalStore . open ( 'LoadingModal' , { loadingMessage } )
40- }
41-
42- if ( uri ) {
43- ModalStore . open ( 'LoadingModal' , { loadingMessage } )
38+ if ( uri || requestId ) {
39+ ModalStore . open ( 'LoadingModal' , { loadingMessage } , ( ) => {
40+ console . log ( 'Modal closed' )
41+ window . close ( )
42+ } )
4443 }
4544 } , [ uri , requestId , loadingMessage ] )
4645
Original file line number Diff line number Diff line change 11import { SessionTypes , SignClientTypes } from '@walletconnect/types'
2- import { WalletKitTypes } from '@reown/walletkit'
3- import { proxy } from 'valtio'
2+ import { proxy , subscribe } from 'valtio'
43
54/**
65 * Types
@@ -52,10 +51,18 @@ const state = proxy<State>({
5251const ModalStore = {
5352 state,
5453
55- open ( view : State [ 'view' ] , data : State [ 'data' ] ) {
54+ open ( view : State [ 'view' ] , data : State [ 'data' ] , onClose ?: ( ) => void ) {
5655 state . view = view
5756 state . data = data
5857 state . open = true
58+ if ( ! onClose ) return
59+ const unsubscribe = subscribe ( state , ( ) => {
60+ if ( ! state . open ) {
61+ console . log ( 'ModalStore: Closing modal' )
62+ unsubscribe ( )
63+ onClose ?.( )
64+ }
65+ } )
5966 } ,
6067
6168 close ( ) {
You can’t perform that action at this time.
0 commit comments