mirror of
https://codeberg.org/emersion/gamja.git
synced 2024-11-14 19:05:01 -05:00
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:
parent
d2ac1e152a
commit
e3e3315125
1 changed files with 4 additions and 10 deletions
|
@ -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 });
|
||||
|
|
Loading…
Reference in a new issue