Skip to content

Commit 7f8c59d

Browse files
committed
Only opt out of resetting connection when changing pw
1 parent aa074c6 commit 7f8c59d

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

src/browser/modules/Stream/Auth/ConnectionForm.jsx

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,15 @@ export class ConnectionForm extends Component {
6767
}
6868
)
6969
}
70-
connect = (doneFn = () => {}, onError = null) => {
70+
connect = (
71+
doneFn = () => {},
72+
onError = null,
73+
noResetConnectionOnFail = false
74+
) => {
7175
this.props.error({})
7276
this.props.bus.self(
7377
CONNECT,
74-
{ ...this.state, noResetConnectionOnFail: true },
78+
{ ...this.state, noResetConnectionOnFail },
7579
res => {
7680
doneFn()
7781
if (res.success) {
@@ -141,17 +145,29 @@ export class ConnectionForm extends Component {
141145
if (res.error.code === 'Neo.ClientError.Security.Unauthorized') {
142146
retries--
143147
if (retries > 0) {
144-
setTimeout(() => this.connect(() => {
145-
this.setState({ isLoading: false })
146-
}, retryFn), 200)
148+
setTimeout(
149+
() =>
150+
this.connect(
151+
() => {
152+
this.setState({ isLoading: false })
153+
},
154+
retryFn,
155+
true
156+
),
157+
200
158+
)
147159
}
148160
} else {
149161
this.props.error(res.error)
150162
}
151163
}
152-
this.connect(() => {
153-
this.setState({ isLoading: false })
154-
}, retryFn)
164+
this.connect(
165+
() => {
166+
this.setState({ isLoading: false })
167+
},
168+
retryFn,
169+
true
170+
)
155171
})
156172
}
157173
this.setState({ isLoading: false })

0 commit comments

Comments
 (0)