fix: catch errors from redux migration

This commit is contained in:
Paul
2021-12-25 16:37:39 +00:00
parent 028a8660c1
commit 064f223c78
3 changed files with 36 additions and 20 deletions

View File

@@ -5,6 +5,8 @@ import { ClientboundNotification } from "revolt.js/dist/websocket/notifications"
import { useEffect } from "preact/hooks";
import { reportError } from "../../lib/ErrorBoundary";
import { useApplicationState } from "../../mobx/State";
import { useClient } from "./RevoltClient";
@@ -28,7 +30,11 @@ export default function SyncManager() {
if (!client) return;
function onPacket(packet: ClientboundNotification) {
if (packet.type === "UserSettingsUpdate") {
state.sync.apply(packet.update);
try {
state.sync.apply(packet.update);
} catch (err) {
reportError(err, "failed_sync_apply");
}
}
}