From ab572a6ed6574d328c94c83a388e84a1b809789d Mon Sep 17 00:00:00 2001 From: dakkar Date: Mon, 14 Apr 2025 17:14:43 +0100 Subject: [PATCH] specal-case `cloudGets` for empty request/response as the comment says, frontend boot calls `cloudGets` with an empty `needs`, and upstream's code returns an empty object without calling the API (because the call `i/registry/get` for each element in `needs`), but we have to special-case it --- packages/frontend/src/preferences.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/frontend/src/preferences.ts b/packages/frontend/src/preferences.ts index 97e01ea85d..8d3cbae797 100644 --- a/packages/frontend/src/preferences.ts +++ b/packages/frontend/src/preferences.ts @@ -87,6 +87,13 @@ const storageProvider: StorageProvider = { }, cloudGets: async (ctx) => { + /* this happens when the frontend boots and there's no logged-in + user; we can't call `i/registry/get-all` because that would + fail, but also we don't need to: return the empty result that + the caller asked for */ + if (ctx.needs.length === 0) { + return {}; + } const cloudDatas = await misskeyApi('i/registry/get-all', { scope: ['client', 'preferences', 'sync'], }) as Record;