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:
@@ -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 />
|
||||
|
||||
Reference in New Issue
Block a user