fix: notes page_count change not working

This commit is contained in:
Shariq Ansari 2024-02-05 13:52:44 +05:30
parent 1d4040a774
commit e74647c225
2 changed files with 11 additions and 3 deletions

View File

@ -362,6 +362,7 @@ function updatePageLength(value, loadMore = false) {
if (loadMore) {
list.value.params.page_length += list.value.params.page_length_count
} else {
if (value == list.value.params.page_length && value == list.value.params.page_length_count) return
list.value.params.page_length = value
list.value.params.page_length_count = value
}

View File

@ -80,7 +80,6 @@
totalCount: notes.data.total_count,
}"
@loadMore="() => loadMore++"
@updatePageCount="(count) => (updatedPageCount = count)"
/>
<div v-else class="flex h-full items-center justify-center">
<div
@ -106,6 +105,7 @@ import UserAvatar from '@/components/UserAvatar.vue'
import NoteIcon from '@/components/Icons/NoteIcon.vue'
import NoteModal from '@/components/Modals/NoteModal.vue'
import ViewControls from '@/components/ViewControls.vue'
import { usersStore } from '@/stores/users'
import { timeAgo, dateFormat, dateTooltipFormat } from '@/utils'
import {
TextEditor,
@ -115,8 +115,7 @@ import {
Breadcrumbs,
ListFooter,
} from 'frappe-ui'
import { ref } from 'vue'
import { usersStore } from '@/stores/users'
import { ref, watch } from 'vue'
const { getUser } = usersStore()
@ -135,6 +134,14 @@ const notes = ref({})
const loadMore = ref(1)
const updatedPageCount = ref(20)
watch(
() => notes.value?.data?.page_length_count,
(val, old_value) => {
if (!val || val === old_value) return
updatedPageCount.value = val
}
)
function createNote() {
currentNote.value = {
title: '',