Inherit from default connectParams in handleConfig

When handleConfig is called, this.state.connectParams will be set
to its default value. Inherit from it so that autoconnect isn't
missing any. If we ever add a new connect parameter, we don't want
an old localStorage to break connect() because it's missing the
param.
This commit is contained in:
Simon Ser 2021-10-09 10:10:51 +02:00
parent d2ac1e152a
commit e3e3315125

View file

@ -184,12 +184,13 @@ export default class App extends Component {
* - URL params
* - Saved parameters in local storage
* - Configuration data (fetched from the config.json file)
* - Default server URL constructed from the current URL location
* - Default server URL constructed from the current URL location (this is
* done in fillConnectParams)
*/
handleConfig(config) {
this.setState({ loading: false });
let connectParams = {};
let connectParams = { ...this.state.connectParams };
if (config.server) {
if (typeof config.server.url === "string") {
@ -233,14 +234,7 @@ export default class App extends Component {
this.config = config;
this.setState((state) => {
return {
connectParams: {
...state.connectParams,
...connectParams,
},
};
});
this.setState({ connectParams: connectParams });
if (connectParams.autoconnect) {
this.setState({ connectForm: false });