From 3a42ac867c04f726ffee47557cf366fedc4f4b07 Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Wed, 1 Apr 2026 09:49:17 +0900 Subject: [PATCH] =?UTF-8?q?260401=5F02=5FENH:=20=EB=B8=8C=EB=9E=9C?= =?UTF-8?q?=EB=93=9C=EC=9D=98=20gap=20=EB=B6=80=EB=B6=84=202=EA=B0=9C=20?= =?UTF-8?q?=EC=97=B0=EB=8F=84=20=EB=82=98=EC=98=AC=EC=88=98=20=EC=9E=88?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../(main)/category/sub-page/CategoryPage.tsx | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/app/(pages)/(main)/category/sub-page/CategoryPage.tsx b/src/app/(pages)/(main)/category/sub-page/CategoryPage.tsx index 6514e7c..6072fe1 100644 --- a/src/app/(pages)/(main)/category/sub-page/CategoryPage.tsx +++ b/src/app/(pages)/(main)/category/sub-page/CategoryPage.tsx @@ -68,26 +68,31 @@ const CategoryPage = () => { const years = Array.from(new Set(rows.map((row) => Number(row.year)))) .filter((year) => Number.isFinite(year)) .sort((a, b) => b - a) - .slice(0, 2); + .slice(0, -1); - if (years.length < 2) { + if(years.length === 0) { nextMap[f.requestKeyResolved] = rows; return; } - const [currentYear, prevYear] = years; - const gapRow = buildGapRow(rows, prevYear, currentYear, "LG"); + const gapRowsByYear = new Map(); - if (!gapRow) { - nextMap[f.requestKeyResolved] = rows; - return; - } + years.forEach((year) => { + const currentYear = year; + const prevYear = year - 1; + const gapRow = buildGapRow(rows, prevYear, currentYear, "LG"); + + if(gapRow !== null){ + gapRowsByYear.set(currentYear, gapRow); + } + }); const nextRows: BannerRow[] = []; rows.forEach((row) => { nextRows.push(row); - if (Number(row.year) === currentYear && row.rowLabel === "LG") { + const gapRow = gapRowsByYear.get(Number(row.year)); + if (row.rowLabel === "LG" && gapRow) { nextRows.push(gapRow); } });