fix(ui): repair reactivity on search fieds in moderation views when on first page

Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2304>
This commit is contained in:
wvffle 2022-12-27 12:39:41 +00:00 committed by Marge
parent 1b6de47a4f
commit fb87d3141a
5 changed files with 51 additions and 32 deletions

View File

@ -100,10 +100,16 @@ const fetchData = async () => {
} }
} }
watchDebounced(query, () => (page.value = 1), { debounce: 300 }) const forceFetchFirstPage = async () => {
page.value = 1
return fetchData()
}
watchDebounced(query, forceFetchFirstPage, { debounce: 300 })
onOrderingUpdate(forceFetchFirstPage)
watch(allowed, forceFetchFirstPage)
watch(page, fetchData) watch(page, fetchData)
watch(allowed, fetchData)
onOrderingUpdate(fetchData)
fetchData() fetchData()
const sharedLabels = useSharedLabels() const sharedLabels = useSharedLabels()

View File

@ -31,6 +31,7 @@ const submit = async () => {
try { try {
const response = await axios.post('manage/users/invitations/', { code: code.value }) const response = await axios.post('manage/users/invitations/', { code: code.value })
invitations.unshift(response.data) invitations.unshift(response.data)
code.value = ''
} catch (error) { } catch (error) {
errors.value = (error as BackendError).backendErrors errors.value = (error as BackendError).backendErrors
} }

View File

@ -81,10 +81,16 @@ const fetchData = async () => {
} }
} }
watchDebounced(query, () => (page.value = 1), { debounce: 300 }) const forceFetchFirstPage = async () => {
watch(isOpen, () => (page.value = 1)) page.value = 1
return fetchData()
}
watchDebounced(query, forceFetchFirstPage, { debounce: 300 })
onOrderingUpdate(forceFetchFirstPage)
watch(isOpen, forceFetchFirstPage)
watch(page, fetchData) watch(page, fetchData)
onOrderingUpdate(fetchData)
fetchData() fetchData()
const sharedLabels = useSharedLabels() const sharedLabels = useSharedLabels()
@ -182,7 +188,7 @@ const labels = computed(() => ({
#row-cells="scope" #row-cells="scope"
> >
<td> <td>
<router-link :to="{name: 'manage.users.users.detail', params: {id: scope.obj.id }}"> <router-link :to="{name: 'manage.moderation.accounts.detail', params: {id: scope.obj.id }}">
{{ scope.obj.owner.username }} {{ scope.obj.owner.username }}
</router-link> </router-link>
</td> </td>

View File

@ -84,9 +84,15 @@ const fetchData = async () => {
} }
} }
watchDebounced(query, () => (page.value = 1), { debounce: 300 }) const forceFetchFirstPage = async () => {
page.value = 1
return fetchData()
}
watchDebounced(query, forceFetchFirstPage, { debounce: 300 })
onOrderingUpdate(forceFetchFirstPage)
watch(page, fetchData) watch(page, fetchData)
onOrderingUpdate(fetchData)
fetchData() fetchData()
const sharedLabels = useSharedLabels() const sharedLabels = useSharedLabels()

View File

@ -3033,29 +3033,29 @@
"filters": { "filters": {
"creationDate": "Creation date", "creationDate": "Creation date",
"releaseDate": "Release date", "releaseDate": "Release date",
"accessedDate": "'Accessed date", "accessedDate": "Accessed date",
"appliedDate": "'Applied date", "appliedDate": "Applied date",
"handledDate": "'Handled date", "handledDate": "Handled date",
"firstSeen": "'First seen date", "firstSeen": "First seen date",
"lastSeen": "'Last seen date", "lastSeen": "Last seen date",
"modificationDate": "'Modification date", "modificationDate": "Modification date",
"expirationDate": "'Expiration date", "expirationDate": "Expiration date",
"trackTitle": "'Track name", "trackTitle": "Track name",
"albumTitle": "'Album name", "albumTitle": "Album name",
"artistName": "'Artist name", "artistName": "Artist name",
"name": "'Name", "name": "Name",
"itemsCount": "'Items", "itemsCount": "Items",
"size": "'Size", "size": "Size",
"bitrate": "'Bitrate", "bitrate": "Bitrate",
"duration": "'Duration", "duration": "Duration",
"dateJoined": "'Sign-up date", "dateJoined": "Sign-up date",
"lastActivity": "'Last activity", "lastActivity": "Last activity",
"username": "'Username", "username": "Username",
"domain": "'Domaimn", "domain": "Domaimn",
"users": "'Users", "users": "Users",
"receivedMessages": "'Received messages", "receivedMessages": "Received messages",
"uploads": "'Uploads", "uploads": "Uploads",
"followers": "'Followers" "followers": "Followers"
}, },
"scopes": { "scopes": {
"profile": { "profile": {