File tree Expand file tree Collapse file tree 1 file changed +27
-8
lines changed Expand file tree Collapse file tree 1 file changed +27
-8
lines changed Original file line number Diff line number Diff line change @@ -72,22 +72,41 @@ const prodCkConfig = getDefaultConfig({
72
72
transports : ENABLE_TESTNET ? undefined : buildTransports ( prodChains ) ,
73
73
...defaultConfig ,
74
74
} ) ;
75
- const prodConfig = createConfig ( {
76
- ...prodCkConfig ,
77
- connectors : prodCkConfig . connectors ?. map ( ( connector ) => {
75
+
76
+ const familyConnectorId = 'familyAccountsProvider' ;
77
+
78
+ const connectorConfig = {
79
+ chains : prodCkConfig . chains ,
80
+ emitter : new Emitter ( '' ) ,
81
+ } ;
82
+
83
+ const connectors = prodCkConfig . connectors
84
+ ?. map ( ( connector ) => {
78
85
// initialize the connector with the emitter so we can access the id
79
- const c = connector ( {
80
- chains : prodCkConfig . chains ,
81
- emitter : new Emitter ( '' ) ,
82
- } ) ;
86
+ const c = connector ( connectorConfig ) ;
83
87
if ( c . id === 'safe' ) {
84
88
return safe ( {
85
89
allowedDomains : [ / g n o s i s - s a f e .i o $ / , / a p p .s a f e .g l o b a l $ / , / d h e d g e .o r g $ / ] ,
86
90
} ) ;
87
91
} else {
88
92
return connector ;
89
93
}
90
- } ) ,
94
+ } )
95
+ . sort ( ( a , b ) => {
96
+ // sort connectors so the family connector is last
97
+ // fixes slow wallet connections when running in the Safe UI
98
+ if ( a ( connectorConfig ) . id === familyConnectorId ) {
99
+ return 1 ;
100
+ }
101
+ if ( b ( connectorConfig ) . id === familyConnectorId ) {
102
+ return - 1 ;
103
+ }
104
+ return 0 ;
105
+ } ) ;
106
+
107
+ const prodConfig = createConfig ( {
108
+ ...prodCkConfig ,
109
+ connectors,
91
110
} ) ;
92
111
93
112
const isCypressEnabled = process . env . NEXT_PUBLIC_IS_CYPRESS_ENABLED === 'true' ;
You can’t perform that action at this time.
0 commit comments