Fix admin users pagination review issues

This commit is contained in:
RWDai
2026-05-20 17:41:06 +08:00
parent 77051e6245
commit e80e7b0cfa
2 changed files with 20 additions and 15 deletions
@@ -274,6 +274,7 @@ import type {
const props = defineProps<{
open: boolean
usersVersion: number
}>()
const emit = defineEmits<{
@@ -299,6 +300,7 @@ const editingGroupId = ref<string | null>(null)
const memberUserIds = ref<string[]>([])
const USER_OPTIONS_CACHE_TTL_MS = 30 * 1000
let dialogUsersLoadedAt = 0
let dialogUsersLoadedVersion = -1
const form = ref({
name: '',
@@ -361,12 +363,17 @@ async function loadDialogData(): Promise<void> {
async function ensureDialogUsers(): Promise<void> {
const now = Date.now()
if (dialogUsersLoadedAt > 0 && now - dialogUsersLoadedAt < USER_OPTIONS_CACHE_TTL_MS) {
if (
dialogUsersLoadedVersion === props.usersVersion
&& dialogUsersLoadedAt > 0
&& now - dialogUsersLoadedAt < USER_OPTIONS_CACHE_TTL_MS
) {
return
}
dialogUsers.value = await usersStore.listAllUsers({ cacheTtlMs: USER_OPTIONS_CACHE_TTL_MS })
dialogUsersLoadedAt = Date.now()
dialogUsersLoadedVersion = props.usersVersion
}
async function selectGroup(groupId: string): Promise<void> {