perf(web): shorten the first open of a space for new members

Accepting an invitation no longer waits for the vault sync, the redundant
join right after joining is skipped, and the crypto state, first log page and
channel metadata are requested in parallel.
This commit is contained in:
justme committed 2026-10-16 05:34:38 +08:00
1 parent d4a72bf177
commit 06fe077ef1
6 files changed
+26 -9

No files matched your search

+2 -1
View File
@@ -260,7 +260,8 @@ export async function acceptInvitation(channelId: string): Promise<void> {
const invitation = (await listAccountInvitations()).find((row) => row.channel_id === channelId);
if (!invitation) throw new Error('邀请已失效');
const link = await openChannelGrant(invitation.payload, session.username, channelId, session.profile.keys.privateKey, 'member', self.location.origin);
stillActive(session); await joinChannel({ link }); await syncVault();
// 保险库同步(约 5 次往返)放到后台,不让用户等着:频道资源已在本机保存,可以直接打开
stillActive(session); await joinChannel({ link }); scheduleSync();
}
export async function inviteChannelUser(channelId: string, input: string): Promise<void> {
requireAccount(); const username = usernameOf(input); const { session, resource } = await getSession(channelId);