Closed toknT closed 2 months ago
Finally I found if using f5 refresh page useQuery
will fire onResult
twice . So change code like this solve it.
const pageSize = 11;
const page = ref(1)
const tableData = ref<PaginatedSystemSetting>(emptyPaginatedSystemSetting)
const { data, status } = await useLazyAsyncData(async () => {
await handleCurrentPageChange(1);
})
const handleCurrentPageChange = async (val: number) => {
page.value = val;
const loading = ElLoading.service({ fullscreen: true })
useQuery<{ data: PaginatedSystemSetting }>(findAllQuery, {
input: { page: page.value, perPage: pageSize },
}, {
fetchPolicy: 'network-only',
prefetch: false,
}).onResult((value) => {
console.debug('onResult', value)
if (value.loading == false) {
tableData.value = value.data.data;
setTimeout(() => { loading.close(); }, 300);
}
});
}
Environment
Nuxt project info: 11:57:42
Describe the bug
I am using nuxtjs+apollo creating admin panel .Using
useLazyAsyncQuery
to loading the table data.However if you press f5 refresh browser the table data will be empty.Expected behaviour
UseLazyAsyncQuery be fired when navigation back in browser.
Reproduction
No response
Additional context
No response
Logs
No response