perf(frontend): cache user lists

This commit is contained in:
syuilo
2023-03-24 16:58:57 +09:00
parent 5f52b13325
commit cabed6098d
4 changed files with 10 additions and 4 deletions

View File

@@ -8,7 +8,7 @@ import { userActions } from '@/store';
import { $i, iAmModerator } from '@/account';
import { mainRouter } from '@/router';
import { Router } from '@/nirax';
import { rolesCache } from '@/cache';
import { rolesCache, userListsCache } from '@/cache';
export function getUserMenu(user: misskey.entities.UserDetailed, router: Router = mainRouter) {
const meId = $i ? $i.id : null;
@@ -127,7 +127,7 @@ export function getUserMenu(user: misskey.entities.UserDetailed, router: Router
icon: 'ti ti-list',
text: i18n.ts.addToList,
children: async () => {
const lists = await os.api('users/lists/list');
const lists = await userListsCache.fetch(() => os.api('users/lists/list'));
return lists.map(list => ({
text: list.name,