diff --git a/components/ProductList.vue b/components/ProductList.vue index 074ab76..863c312 100644 --- a/components/ProductList.vue +++ b/components/ProductList.vue @@ -120,12 +120,18 @@ export default defineComponent({ methods: { chunkInefficient(products: Array, chunkSize: number):Array> { const out:Array> = []; - // eslint-disable-next-line @typescript-eslint/no-unused-vars + let row: Array = []; + products.forEach((elem: TypeProduct, i: number) => { - if (i % chunkSize) { - out.push(products.slice(i, i + chunkSize)); + row.push(elem); + if (i % chunkSize && row.length) { + out.push(row); + row = []; } }); + if (row.length) { + out.push(row); + } return out; }, t(text: string, params: Record = {}, localeToUse: string | null = null): string {