From 003cf6138865f76ac5600c6f5a311319a69f1879 Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Thu, 29 Mar 2018 21:16:35 +0100 Subject: [PATCH] Handle remove sticker picker errors. --- src/components/views/rooms/Stickerpicker.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/views/rooms/Stickerpicker.js b/src/components/views/rooms/Stickerpicker.js index e589b391d6..32bf284c19 100644 --- a/src/components/views/rooms/Stickerpicker.js +++ b/src/components/views/rooms/Stickerpicker.js @@ -66,10 +66,14 @@ export default class Stickerpicker extends React.Component { } else { console.warn('No widget ID specified, not disabling assets'); } - Widgets.removeStickerpickerWidgets(); - this._getStickerPickerWidget(); + // Wrap this in a timeout in order to avoid the DOM node from being pulled from under its feet setTimeout(() => this.stickersMenu.close()); + Widgets.removeStickerpickerWidgets().then(() => { + this._getStickerPickerWidget(); + }).catch((e) => { + console.error('Failed to remove sticker picker widget', e); + }); } componentDidMount() {