Gate search behind CompanySettings.searchEnabled; fix two reported bugs

Search icon now gated behind the new backend toggle, same pattern as
wishlistEnabled — off by default.

Fixed: blog category filter bar was invisible — it was wrapped in
<Reveal>, which sits right at/just past the hero's bottom edge, the
exact "already near the initial viewport" position Reveal.tsx's own
comment documents as a whileInView(margin:"-80px") trap (an element
already visible without scrolling can permanently never register as
"entered view", since `once: true` never gets a second chance). Now a
plain div, no scroll-reveal animation needed for a filter bar anyway.

Fixed: wishlist count showing one behind on the Navbar badge —
useWishlist.ts's toggle() broadcast the "refetch me" event immediately
after the optimistic local update, before the POST request was even
sent. Another instance's resulting refetch could race the actual
server-side write, get the pre-toggle list, and then never get told to
refetch again. Broadcast now only fires after the request settles.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Marco
2026-07-30 22:51:37 +00:00
parent 2eda211a29
commit bc40e22910
5 changed files with 59 additions and 13 deletions
+10 -2
View File
@@ -246,7 +246,15 @@ function CartLink() {
);
}
export function Navbar({ singleActiveProduct, wishlistEnabled }: { singleActiveProduct: boolean; wishlistEnabled: boolean }) {
export function Navbar({
singleActiveProduct,
wishlistEnabled,
searchEnabled,
}: {
singleActiveProduct: boolean;
wishlistEnabled: boolean;
searchEnabled: boolean;
}) {
const pathname = usePathname();
const [scrolled, setScrolled] = useState(false);
const [activeSection, setActiveSection] = useState("");
@@ -545,7 +553,7 @@ export function Navbar({ singleActiveProduct, wishlistEnabled }: { singleActiveP
built-in padding read as too much space on mobile, where
these two icons are the only always-visible controls. */}
<div className="flex items-center">
<SearchButton />
{searchEnabled && <SearchButton />}
<AccountLink />
{wishlistEnabled && <WishlistLink />}
<CartLink />