From f95feafb1a45b9bdf1ea094585a40a6afa046120 Mon Sep 17 00:00:00 2001 From: Marco Date: Sat, 1 Aug 2026 06:29:53 +0000 Subject: [PATCH] Fix blog post list staying invisible after re-filtering categories MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RevealGroup's whileInView fires once per component instance. Since a category-filter navigation re-renders the same /blog page in place (only searchParams changes, no full remount), and rest.length stays > 0 across most filter transitions, RevealGroup itself never naturally unmounts — so once it already fired "show" for one filter's list, newly swapped-in RevealItems (different post ids) mounted into an already-settled parent with no reason to re-fire the reveal trigger, staying stuck at opacity 0 forever. Keying RevealGroup (and the featured Reveal) on the actual rendered post set forces a remount whenever the filtered posts change, restarting the viewport tracking each time. --- app/blog/page.tsx | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/app/blog/page.tsx b/app/blog/page.tsx index d2f2854..832efdf 100644 --- a/app/blog/page.tsx +++ b/app/blog/page.tsx @@ -109,7 +109,11 @@ export default async function BlogOverviewPage({ // -mt-8, not pt-10 — pulls the card up to slightly overlap the // hero section's bottom edge instead of sitting flush below it. // relative z-10 keeps it stacked above the hero's own photo. - + // key'd for the same reason as RevealGroup below — guards against + // the same stuck-at-opacity-0 failure mode if a future filter + // combination ever swaps in a *different* featured post without + // an intervening moment where `featured` was falsy. + 0 && ( - + // key'd on the rendered post set — RevealGroup's `whileInView` + // only fires once per component instance (viewport.once=true), + // and a category-filter change re-renders this same page + // component in place (only `searchParams` differs, no full + // remount). Since `rest.length > 0` stays true across most + // filter transitions, RevealGroup itself never naturally + // unmounts, so once it has already fired "show" for one + // filter's list, freshly swapped-in RevealItems (new post ids) + // mount into an already-settled parent that has no reason to + // re-fire the reveal trigger — they were stuck at opacity 0 + // forever, reported as the list appearing blank after refiltering. + // Forcing a remount on every distinct post set restarts + // RevealGroup's viewport tracking from scratch each time. + post.id).join(",")} + className="flex flex-col w-full max-w-[80rem] mx-auto px-[var(--layout-padding-x)] py-6 divide-y divide-border" + > {rest.map((post) => (