ensure local state for aliases doesn't get garbled up
when removing another alias before the response of the first comes back
This commit is contained in:
parent
b09c063d1b
commit
7b1b4cda14
1 changed files with 2 additions and 2 deletions
|
@ -233,11 +233,11 @@ export default class AliasSettings extends React.Component {
|
||||||
|
|
||||||
onLocalAliasDeleted = (index) => {
|
onLocalAliasDeleted = (index) => {
|
||||||
const alias = this.state.localAliases[index];
|
const alias = this.state.localAliases[index];
|
||||||
|
console.log("removing local alias", index, alias);
|
||||||
// TODO: In future, we should probably be making sure that the alias actually belongs
|
// TODO: In future, we should probably be making sure that the alias actually belongs
|
||||||
// to this room. See https://github.com/vector-im/riot-web/issues/7353
|
// to this room. See https://github.com/vector-im/riot-web/issues/7353
|
||||||
MatrixClientPeg.get().deleteAlias(alias).then(() => {
|
MatrixClientPeg.get().deleteAlias(alias).then(() => {
|
||||||
const localAliases = this.state.localAliases.slice();
|
const localAliases = this.state.localAliases.filter(a => a !== alias);
|
||||||
localAliases.splice(index, 1);
|
|
||||||
this.setState({localAliases});
|
this.setState({localAliases});
|
||||||
|
|
||||||
if (this.state.canonicalAlias === alias) {
|
if (this.state.canonicalAlias === alias) {
|
||||||
|
|
Loading…
Reference in a new issue