Skip to content

Commit b5cd745

Browse files
feat: different fetch limits for map and list layouts
1 parent a06b99f commit b5cd745

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

client-app/shared/checkout/composables/useBopis.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import type { AnyAddressType } from "@/core/types";
99

1010
export const BOPIS_CODE = "BuyOnlinePickupInStore";
1111

12-
const ADDRESSES_FETCH_LIMIT = 50;
12+
const ADDRESSES_FETCH_MAP_LIMIT = 50;
13+
const ADDRESSES_FETCH_LIST_LIMIT = 200;
1314

1415
export function useBopis() {
1516
const { t } = useI18n();
@@ -33,6 +34,8 @@ export function useBopis() {
3334
: defineAsyncComponent(() => import("@/shared/checkout/components/select-address-modal.vue")),
3435
);
3536

37+
const fetchLimit = computed(() => (isBopisMapEnabled.value ? ADDRESSES_FETCH_MAP_LIMIT : ADDRESSES_FETCH_LIST_LIMIT));
38+
3639
const modalOpening = ref(false);
3740

3841
const normalizedAddresses = computed<AnyAddressType[]>(() =>
@@ -74,7 +77,7 @@ export function useBopis() {
7477
try {
7578
await fetchAddresses({
7679
cartId,
77-
first: ADDRESSES_FETCH_LIMIT,
80+
first: fetchLimit.value,
7881
});
7982
} finally {
8083
modalOpening.value = false;
@@ -111,7 +114,7 @@ export function useBopis() {
111114
onFilterChange: async () => {
112115
await fetchAddresses({
113116
cartId,
114-
first: ADDRESSES_FETCH_LIMIT,
117+
first: fetchLimit.value,
115118
keyword: filterKeyword.value,
116119
filter: buildFilter(),
117120
});

0 commit comments

Comments
 (0)