mirror of
https://codeberg.org/emersion/gamja
synced 2025-03-13 07:48:37 +01: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
@ -184,12 +184,13 @@ export default class App extends Component {
|
|||||||
* - URL params
|
* - URL params
|
||||||
* - Saved parameters in local storage
|
* - Saved parameters in local storage
|
||||||
* - Configuration data (fetched from the config.json file)
|
* - 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) {
|
handleConfig(config) {
|
||||||
this.setState({ loading: false });
|
this.setState({ loading: false });
|
||||||
|
|
||||||
let connectParams = {};
|
let connectParams = { ...this.state.connectParams };
|
||||||
|
|
||||||
if (config.server) {
|
if (config.server) {
|
||||||
if (typeof config.server.url === "string") {
|
if (typeof config.server.url === "string") {
|
||||||
@ -233,14 +234,7 @@ export default class App extends Component {
|
|||||||
|
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
|
||||||
this.setState((state) => {
|
this.setState({ connectParams: connectParams });
|
||||||
return {
|
|
||||||
connectParams: {
|
|
||||||
...state.connectParams,
|
|
||||||
...connectParams,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
if (connectParams.autoconnect) {
|
if (connectParams.autoconnect) {
|
||||||
this.setState({ connectForm: false });
|
this.setState({ connectForm: false });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user