Skip to content

Modern Docker Management, Designed for Everyone

fix: use dynamic limit for dashboard tables on page refreshes

Kyle Mendellf0be4d2ccabd
diff --git a/frontend/src/routes/dashboard/dash-container-table.svelte b/frontend/src/routes/dashboard/dash-container-table.svelte
index 14cef86ee..18752e349 100644
--- a/frontend/src/routes/dashboard/dash-container-table.svelte
+++ b/frontend/src/routes/dashboard/dash-container-table.svelte
@@ -58,7 +58,11 @@
let lastFetchedLimit = $state(5);
$effect(() => {
- if (calculatedLimit !== lastFetchedLimit && requestOptions.pagination) {
+ const currentLimit = containers.pagination?.itemsPerPage;
+ if (
+ requestOptions.pagination &&
+ (calculatedLimit !== lastFetchedLimit || (currentLimit !== undefined && currentLimit !== calculatedLimit))
+ ) {
lastFetchedLimit = calculatedLimit;
requestOptions.pagination.limit = calculatedLimit;
containerService.getContainers(requestOptions).then((result) => (containers = result));
@@ -139,7 +143,7 @@
</Card.Header>
<Card.Content class="relative flex min-h-0 flex-1 flex-col px-0">
<ArcaneTable
- items={containers}
+ items={{ ...containers, data: containers.data.slice(0, calculatedLimit) }}
bind:requestOptions
bind:selectedIds
onRefresh={async (options) => (containers = await containerService.getContainers(options))}
diff --git a/frontend/src/routes/dashboard/dash-image-table.svelte b/frontend/src/routes/dashboard/dash-image-table.svelte
index 317227516..b70df1012 100644
--- a/frontend/src/routes/dashboard/dash-image-table.svelte
+++ b/frontend/src/routes/dashboard/dash-image-table.svelte
@@ -57,7 +57,11 @@
let lastFetchedLimit = $state(5);
$effect(() => {
- if (calculatedLimit !== lastFetchedLimit && requestOptions.pagination) {
+ const currentLimit = images.pagination?.itemsPerPage;
+ if (
+ requestOptions.pagination &&
+ (calculatedLimit !== lastFetchedLimit || (currentLimit !== undefined && currentLimit !== calculatedLimit))
+ ) {
lastFetchedLimit = calculatedLimit;
requestOptions.pagination.limit = calculatedLimit;
imageService.getImages(requestOptions).then((result) => (images = result));
@@ -152,7 +156,7 @@
</Card.Header>
<Card.Content class="relative flex min-h-0 flex-1 flex-col px-0">
<ArcaneTable
- items={images}
+ items={{ ...images, data: images.data.slice(0, calculatedLimit) }}
bind:requestOptions
bind:selectedIds
onRefresh={async (options) => (images = await imageService.getImages(options))}