perf(frontend): cache user lists
This commit is contained in:
		@@ -24,6 +24,7 @@ import MkAvatars from '@/components/MkAvatars.vue';
 | 
			
		||||
import * as os from '@/os';
 | 
			
		||||
import { i18n } from '@/i18n';
 | 
			
		||||
import { definePageMetadata } from '@/scripts/page-metadata';
 | 
			
		||||
import { userListsCache } from '@/cache';
 | 
			
		||||
 | 
			
		||||
const pagingComponent = $shallowRef<InstanceType<typeof MkPagination>>();
 | 
			
		||||
 | 
			
		||||
@@ -38,6 +39,7 @@ async function create() {
 | 
			
		||||
	});
 | 
			
		||||
	if (canceled) return;
 | 
			
		||||
	await os.apiWithDialog('users/lists/create', { name: name });
 | 
			
		||||
	userListsCache.delete();
 | 
			
		||||
	pagingComponent.reload();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -37,6 +37,7 @@ import { definePageMetadata } from '@/scripts/page-metadata';
 | 
			
		||||
import { i18n } from '@/i18n';
 | 
			
		||||
import { userPage } from '@/filters/user';
 | 
			
		||||
import MkUserCardMini from '@/components/MkUserCardMini.vue';
 | 
			
		||||
import { userListsCache } from '@/cache';
 | 
			
		||||
 | 
			
		||||
const props = defineProps<{
 | 
			
		||||
	listId: string;
 | 
			
		||||
@@ -97,6 +98,8 @@ async function renameList() {
 | 
			
		||||
		name: name,
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	userListsCache.delete();
 | 
			
		||||
 | 
			
		||||
	list.name = name;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -107,10 +110,10 @@ async function deleteList() {
 | 
			
		||||
	});
 | 
			
		||||
	if (canceled) return;
 | 
			
		||||
 | 
			
		||||
	await os.api('users/lists/delete', {
 | 
			
		||||
	await os.apiWithDialog('users/lists/delete', {
 | 
			
		||||
		listId: list.id,
 | 
			
		||||
	});
 | 
			
		||||
	os.success();
 | 
			
		||||
	userListsCache.delete();
 | 
			
		||||
	mainRouter.push('/my/lists');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user