File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
redisinsight/ui/src/slices/oauth Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -236,14 +236,20 @@ export const oauthCapiKeysSelector = (state: RootState) => state.oauth.cloud.cap
236
236
export default oauthCloudSlice . reducer
237
237
238
238
export function createFreeDbSuccess ( id : string , history : any ) {
239
- return async ( dispatch : AppDispatch ) => {
239
+ return async ( dispatch : AppDispatch , stateInit : ( ) => RootState ) => {
240
240
try {
241
241
const onConnect = ( ) => {
242
- dispatch ( resetKeys ( ) )
243
- dispatch ( setAppContextInitialState ( ) )
244
- dispatch ( setConnectedInstanceId ( id ?? '' ) )
242
+ const state = stateInit ( )
243
+ const isConnected = state . app ?. context ?. contextInstanceId === id
244
+
245
245
dispatch ( removeInfiniteNotification ( InfiniteMessagesIds . oAuthSuccess ) )
246
- dispatch ( checkConnectToInstanceAction ( id ) )
246
+
247
+ if ( ! isConnected ) {
248
+ dispatch ( resetKeys ( ) )
249
+ dispatch ( setAppContextInitialState ( ) )
250
+ dispatch ( setConnectedInstanceId ( id ?? '' ) )
251
+ dispatch ( checkConnectToInstanceAction ( id ) )
252
+ }
247
253
248
254
history . push ( Pages . workbench ( id ) )
249
255
}
You can’t perform that action at this time.
0 commit comments