Fix integration manager not updating when set

setUserWidget was modifying the content of the old event itself,
so when `waitForUserWidget()` checked the content to see if it was
there yet, it was, but because the echo hadn't come back, the
IntegrationManager hadn't rebuilt its list.

In other news, its terrifying that we can just accidentally modify
the content of an event in the store. I'm going to make a js-sdk
PR that freezes the content and see what breaks...

Fixes https://github.com/vector-im/riot-web/issues/10977
This commit is contained in:
David Baker 2019-10-02 15:26:54 +01:00
parent c8c4dc29d1
commit d82a05fbae

View File

@ -233,7 +233,9 @@ export default class WidgetUtils {
}; };
const client = MatrixClientPeg.get(); const client = MatrixClientPeg.get();
const userWidgets = WidgetUtils.getUserWidgets(); // Get the current widgets and clone them before we modify them, otherwise
// we'll modify the content of the old event.
const userWidgets = JSON.parse(JSON.stringify(WidgetUtils.getUserWidgets()));
// Delete existing widget with ID // Delete existing widget with ID
try { try {