Improve Account admin page titles and list URLs#3315
Conversation
There was a problem hiding this comment.
Code Review
This pull request integrates page titles and synchronizes pagination, sorting, and filter states with route query parameters across various admin pages. The review feedback highlights a critical race condition in audit-logs.vue where resetting multiple route query parameters sequentially in clearFilters() causes conflicting asynchronous router updates. It is recommended to import useRouter and batch-update the query parameters in a single router push to resolve this issue.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| import { computed } from 'vue' | ||
|
|
||
| import { useQuery } from '@/utils/query' | ||
| import { useRouteQueryParamInt, useRouteQueryParamStr, useRouteQueryParamStrEnum } from '@/utils/route' | ||
| import { usePageTitle } from '@/utils/utils' |
There was a problem hiding this comment.
Import useRouter from vue-router to allow batch updating the route query parameters in clearFilters and avoid race conditions.
import { computed } from 'vue'
import { useRouter } from 'vue-router'
import { useQuery } from '@/utils/query'
import { useRouteQueryParamInt, useRouteQueryParamStr, useRouteQueryParamStrEnum } from '@/utils/route'
import { usePageTitle } from '@/utils/utils'
| const pageSize = 20 | ||
| const page = useRouteQueryParamInt('p', 1) | ||
| const resetPage = (query: Partial<Record<string, string | null>>) => ({ ...query, p: null }) | ||
| const sortOrder = useRouteQueryParamStrEnum('order', SortOrder, SortOrder.Desc, resetPage) | ||
| const createdAfter = useRouteQueryParamStr('from', '', resetPage) | ||
| const createdBefore = useRouteQueryParamStr('to', '', resetPage) |
There was a problem hiding this comment.
Synchronously setting both createdAfter.value = '' and createdBefore.value = '' inside clearFilters() triggers two consecutive, asynchronous router pushes. Because Vue Router updates the route query asynchronously, the second push will read the stale route query (which still contains the old from value) and overwrite the first push. As a result, only one of the filters will actually be cleared.
To fix this, define router here and update clearFilters() to perform a single router push to clear both query parameters at once:
function clearFilters() {
router.push({
query: {
...router.currentRoute.value.query,
from: undefined,
to: undefined,
p: undefined
}
})
}const router = useRouter()
const pageSize = 20
const page = useRouteQueryParamInt('p', 1)
const resetPage = (query: Partial<Record<string, string | null>>) => ({ ...query, p: null })
const sortOrder = useRouteQueryParamStrEnum('order', SortOrder, SortOrder.Desc, resetPage)
const createdAfter = useRouteQueryParamStr('from', '', resetPage)
const createdBefore = useRouteQueryParamStr('to', '', resetPage)
Closes #3313
Changes
Checks
Notes