fix(mobx): properly persist login state

This commit is contained in:
Paul
2021-12-24 12:00:24 +00:00
parent ef1ddb7771
commit 189d0b5ff9
5 changed files with 12 additions and 4 deletions

View File

@@ -15,7 +15,9 @@ export default function SyncManager() {
// Sync settings from Revolt.
useEffect(() => {
state.sync.pull(client);
if (client) {
state.sync.pull(client);
}
}, [client]);
// Keep data synced.
@@ -23,6 +25,7 @@ export default function SyncManager() {
// Take data updates from Revolt.
useEffect(() => {
if (!client) return;
function onPacket(packet: ClientboundNotification) {
if (packet.type === "UserSettingsUpdate") {
state.sync.apply(packet.update);