Skip to content

Commit

Permalink
fix: if cancelled error skip it cancelled to avoid unnecessary call
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavxc committed Dec 14, 2023
1 parent 4953f21 commit 2f4b7be
Showing 1 changed file with 25 additions and 17 deletions.
42 changes: 25 additions & 17 deletions packages/nc-gui/composables/useViewData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,24 +187,32 @@ export function useViewData(
controller.value = CancelToken.source()

isPaginationLoading.value = true
let response

const response = !isPublic.value
? await api.dbViewRow.list(
'noco',
base.value.id!,
metaId.value!,
viewMeta.value!.id!,
{
...queryParams.value,
...params,
...(isUIAllowed('sortSync') ? {} : { sortArrJson: JSON.stringify(sorts.value) }),
...(isUIAllowed('filterSync') ? {} : { filterArrJson: JSON.stringify(nestedFilters.value) }),
where: where?.value,
} as any,
{ cancelToken: controller.value.token },
)
: await fetchSharedViewData({ sortsArr: sorts.value, filtersArr: nestedFilters.value })

try {
response = !isPublic.value
? await api.dbViewRow.list(
'noco',
base.value.id!,
metaId.value!,
viewMeta.value!.id!,
{
...queryParams.value,
...params,
...(isUIAllowed('sortSync') ? {} : { sortArrJson: JSON.stringify(sorts.value) }),
...(isUIAllowed('filterSync') ? {} : { filterArrJson: JSON.stringify(nestedFilters.value) }),
where: where?.value,
} as any,
{ cancelToken: controller.value.token },
)
: await fetchSharedViewData({ sortsArr: sorts.value, filtersArr: nestedFilters.value })
} catch (error) {
// if the request is canceled, then do nothing
if (error.code === 'ERR_CANCELED') {
return
}
throw error
}
formattedData.value = formatData(response.list)
paginationData.value = response.pageInfo
isPaginationLoading.value = false
Expand Down

1 comment on commit 2f4b7be

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR changes have been deployed. Please run the following command to verify:

docker run -d -p 8888:8080 nocodb/nocodb-timely:0.202.10-pr-7230-20231214-0713

Please sign in to comment.