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({
7272 transports : ENABLE_TESTNET ? undefined : buildTransports ( prodChains ) ,
7373 ...defaultConfig ,
7474} ) ;
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 ) => {
7885 // 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 ) ;
8387 if ( c . id === 'safe' ) {
8488 return safe ( {
8589 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 $ / ] ,
8690 } ) ;
8791 } else {
8892 return connector ;
8993 }
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,
91110} ) ;
92111
93112const isCypressEnabled = process . env . NEXT_PUBLIC_IS_CYPRESS_ENABLED === 'true' ;
You can’t perform that action at this time.
0 commit comments