manage voicerecording state when deleting or sending a voice message (#7896)

* manage voicerecording state when deleting or sending a voice message

Signed-off-by: Kerry Archibald <kerrya@element.io>

* comment

Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
Kerry 2022-02-24 18:54:06 +01:00 committed by GitHub
parent 5167b30ee6
commit 130bd6aa63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 108 additions and 1 deletions

View file

@ -82,7 +82,15 @@ export class VoiceRecordingStore extends AsyncStoreWithClient<IState> {
if (this.state[roomId]) {
this.state[roomId].destroy(); // stops internally
}
return this.updateState(Object.fromEntries(Object.entries(this.state).filter(e => e[0] !== roomId)));
const {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
[roomId]: _toDelete,
...newState
} = this.state;
// unexpectedly AsyncStore.updateState merges state
// AsyncStore.reset actually just *sets*
return this.reset(newState);
}
}