From 4219a7b4e7fb93477c5bb5e5affda699ac0c6b6d Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Tue, 5 May 2026 09:41:49 +0300 Subject: [PATCH] fix: correct RSC error patterns and extract skills grouping to utility --- .../BioSection/ui/BioSection/BioSection.tsx | 3 ++- .../ui/IntroSection/IntroSection.tsx | 3 ++- .../ui/SkillsSection/SkillsSection.tsx | 17 +++++++---------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/widgets/BioSection/ui/BioSection/BioSection.tsx b/src/widgets/BioSection/ui/BioSection/BioSection.tsx index b6fb8d0..9c3c3ab 100644 --- a/src/widgets/BioSection/ui/BioSection/BioSection.tsx +++ b/src/widgets/BioSection/ui/BioSection/BioSection.tsx @@ -1,3 +1,4 @@ +import { notFound } from 'next/navigation'; import type { PageContentRecord } from '$shared/api'; import { getFirstRecord } from '$shared/api'; @@ -11,7 +12,7 @@ export default async function BioSection() { }); if (!data) { - return

Loading bio content...

; + notFound(); } return ( diff --git a/src/widgets/IntroSection/ui/IntroSection/IntroSection.tsx b/src/widgets/IntroSection/ui/IntroSection/IntroSection.tsx index 20b0b92..28a242e 100644 --- a/src/widgets/IntroSection/ui/IntroSection/IntroSection.tsx +++ b/src/widgets/IntroSection/ui/IntroSection/IntroSection.tsx @@ -1,3 +1,4 @@ +import { notFound } from 'next/navigation'; import type { PageContentRecord } from '$shared/api'; import { getFirstRecord } from '$shared/api'; @@ -11,7 +12,7 @@ export default async function IntroSection() { }); if (!data) { - return

Loading intro content...

; + notFound(); } return ( diff --git a/src/widgets/SkillsSection/ui/SkillsSection/SkillsSection.tsx b/src/widgets/SkillsSection/ui/SkillsSection/SkillsSection.tsx index 7669043..5adccfb 100644 --- a/src/widgets/SkillsSection/ui/SkillsSection/SkillsSection.tsx +++ b/src/widgets/SkillsSection/ui/SkillsSection/SkillsSection.tsx @@ -1,5 +1,7 @@ +import { notFound } from 'next/navigation'; import type { SkillRecord } from '$shared/api'; import { getCollection } from '$shared/api'; +import { groupByKey } from '$shared/lib'; import { Badge } from '$shared/ui'; /** @@ -11,16 +13,11 @@ export default async function SkillsSection() { sort: 'category,order', }); - const categories = data.items.reduce( - (acc, skill) => { - if (!acc[skill.category]) { - acc[skill.category] = []; - } - acc[skill.category].push(skill); - return acc; - }, - {} as Record, - ); + if (!data.items.length) { + notFound(); + } + + const categories = groupByKey(data.items, 'category'); return (