fix(app): keep hydrated state across gateway session resumes (#1862)

This commit is contained in:
Hampus authored and GitHub committed 2026-08-24 12:33:27 +02:00
1 parent b7f75e25ad
commit 943b948de7
41 files changed
+81 -690

No files matched your search

@@ -128,7 +128,7 @@ class UserGuildSettings {
updateGuildSettings: action,
updateChannelOverride: action,
updateChannelOverrides: action,
handleConnectionOpen: action,
handleGatewayReady: action,
notifyChange: action,
});
}
@@ -564,7 +564,7 @@ class UserGuildSettings {
);
}
handleConnectionOpen(userGuildSettings: Array<GatewayGuildSettings>): void {
handleGatewayReady(userGuildSettings: Array<GatewayGuildSettings>): void {
this.clearAllTimers();
this.guildSettings.clear();
this.mutedChannelsByGuild.clear();
@@ -23,7 +23,7 @@ class UserProfile {
return this.profiles[userId]?.[guildId ?? ME] ?? null;
}
handleConnectionOpen(): void {
handleGatewayReady(): void {
Object.values(this.profileTimeouts).forEach(clearTimeout);
this.profiles = {};
this.profileTimeouts = {};
@@ -595,7 +595,7 @@ class UserSettingsState {
LocalPresence.updatePresence();
}
handleConnectionOpen(userSettings: unknown): void {
handleGatewayReady(userSettings: unknown): void {
this.updateUserSettings(userSettings);
}
+2 -2
View File
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {openClaimAccountModal} from '@app/features/auth/components/modals/ClaimAccountModal';
import Authentication from '@app/features/auth/state/Authentication';
import {User} from '@app/features/user/models/User';
import type {UserPrivate, User as WireUser} from '@fluxer/schema/src/domains/user/UserResponseSchemas';
@@ -94,7 +93,7 @@ class Users {
}
@action
handleConnectionOpen(currentUser: UserPrivate): void {
handleGatewayReady(currentUser: UserPrivate): void {
const userRecord = new User(currentUser);
this.users = {
[currentUser.id]: userRecord,
@@ -102,6 +101,7 @@ class Users {
this.userCount = 1;
if (!userRecord.isClaimed()) {
setTimeout(async () => {
const {openClaimAccountModal} = await import('@app/features/auth/components/modals/ClaimAccountModal');
openClaimAccountModal();
}, 1000);
}
@@ -24,7 +24,7 @@ class WebAuthnCredentials {
logger.debug(`Set WebAuthn credentials: ${credentials.length}`);
}
handleConnectionOpen(credentials: ReadonlyArray<WebAuthnCredential> | undefined): void {
handleGatewayReady(credentials: ReadonlyArray<WebAuthnCredential> | undefined): void {
this.setCredentials(credentials ?? []);
}