Fix config becoming unblocked while still in progress
This commit is contained in:
12
ui.html
12
ui.html
@@ -112,7 +112,7 @@
|
||||
}
|
||||
|
||||
class Settings extends Component {
|
||||
state = { inProgress: true, config: 'Connecting...' };
|
||||
state = { inProgress: false, config: 'Connecting...' };
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
@@ -124,10 +124,6 @@
|
||||
})();
|
||||
}
|
||||
|
||||
setStatePromise(state) {
|
||||
return new Promise(resolve => this.setState(state, resolve));
|
||||
}
|
||||
|
||||
handleInput = async e => {
|
||||
let name = e.target.id;
|
||||
if (!name.startsWith('config-')) {
|
||||
@@ -147,7 +143,7 @@
|
||||
break;
|
||||
}
|
||||
|
||||
await this.setStatePromise({ inProgress: true });
|
||||
this.setState({ inProgress: true });
|
||||
|
||||
try {
|
||||
await scheduleOp(() => context.setConfigValue(name, value));
|
||||
@@ -156,6 +152,7 @@
|
||||
}
|
||||
|
||||
await this.refreshConfig();
|
||||
this.setState({ inProgress: false });
|
||||
};
|
||||
|
||||
async refreshConfig() {
|
||||
@@ -165,8 +162,7 @@
|
||||
} catch (e) {
|
||||
config = String(e);
|
||||
}
|
||||
await this.setStatePromise({
|
||||
inProgress: false,
|
||||
this.setState({
|
||||
config
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user