mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 12:36:57 +00:00
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
This commit is contained in:
parent
31249a571f
commit
ab572a6ed6
1 changed files with 7 additions and 0 deletions
|
@ -87,6 +87,13 @@ const storageProvider: StorageProvider = {
|
||||||
},
|
},
|
||||||
|
|
||||||
cloudGets: async (ctx) => {
|
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', {
|
const cloudDatas = await misskeyApi('i/registry/get-all', {
|
||||||
scope: ['client', 'preferences', 'sync'],
|
scope: ['client', 'preferences', 'sync'],
|
||||||
}) as Record<string, [any, any][] | undefined>;
|
}) as Record<string, [any, any][] | undefined>;
|
||||||
|
|
Loading…
Add table
Reference in a new issue