From 7b1b4cda14625fced42cf43641f00e175c8c5af7 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 17 Mar 2020 20:37:40 +0100 Subject: [PATCH] ensure local state for aliases doesn't get garbled up when removing another alias before the response of the first comes back --- src/components/views/room_settings/AliasSettings.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/views/room_settings/AliasSettings.js b/src/components/views/room_settings/AliasSettings.js index f8e2151c4f..bdcb22342c 100644 --- a/src/components/views/room_settings/AliasSettings.js +++ b/src/components/views/room_settings/AliasSettings.js @@ -233,11 +233,11 @@ export default class AliasSettings extends React.Component { onLocalAliasDeleted = (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 // to this room. See https://github.com/vector-im/riot-web/issues/7353 MatrixClientPeg.get().deleteAlias(alias).then(() => { - const localAliases = this.state.localAliases.slice(); - localAliases.splice(index, 1); + const localAliases = this.state.localAliases.filter(a => a !== alias); this.setState({localAliases}); if (this.state.canonicalAlias === alias) {