perf(web): shorten the cold start when opening a saved space
ci/woodpecker/push/web-build Pipeline was successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/push/dev-image Pipeline was successful

Activate the account with parallel requests, run the full vault sync in the
background, skip the duplicate space list request, and send the rejoin
together with the first screen of data. [CI]
This commit is contained in:
justme committed 2026-10-16 06:00:17 +08:00
1 parent f2e118c966
commit b1ac11e1d7
3 files changed
+19 -11

No files matched your search

+3 -1
View File
@@ -24,7 +24,7 @@ interface ChannelsState {
const upsert = (list: ChannelInfo[], c: ChannelInfo) => [c, ...list.filter((x) => x.id !== c.id)];
let hydration: Promise<void> | undefined;
export const useChannels = create<ChannelsState>()((set) => ({
export const useChannels = create<ChannelsState>()((set, get) => ({
list: [],
hydrated: false,
pendingLink: null,
@@ -41,6 +41,8 @@ export const useChannels = create<ChannelsState>()((set) => ({
return c;
},
hydrate: () => {
// 账号刷新已经列过一次,别再请求一遍
if (get().hydrated) return Promise.resolve();
hydration ??= api.listSaved().then((list) => set({ list, hydrated: true }), () => set({ hydrated: true }));
return hydration;
},