From 049d903a5bf60d34981c85a0b7883e912a98045d Mon Sep 17 00:00:00 2001 From: Kai Hao Date: Sat, 29 Jul 2023 00:19:13 +0800 Subject: [PATCH 1/2] Removes unnecessary `useEffect`'s on search sorts (#1124) --- components/layout/search/filter/item.tsx | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/components/layout/search/filter/item.tsx b/components/layout/search/filter/item.tsx index d9298582c..38777ea48 100644 --- a/components/layout/search/filter/item.tsx +++ b/components/layout/search/filter/item.tsx @@ -5,22 +5,17 @@ import { SortFilterItem } from 'lib/constants'; import { createUrl } from 'lib/utils'; import Link from 'next/link'; import { usePathname, useSearchParams } from 'next/navigation'; -import { useEffect, useState } from 'react'; import type { ListItem, PathFilterItem } from '.'; function PathFilterItem({ item }: { item: PathFilterItem }) { const pathname = usePathname(); const searchParams = useSearchParams(); - const [active, setActive] = useState(pathname === item.path); + const active = pathname === item.path; const newParams = new URLSearchParams(searchParams.toString()); const DynamicTag = active ? 'p' : Link; newParams.delete('q'); - useEffect(() => { - setActive(pathname === item.path); - }, [pathname, item.path]); - return (
  • { - setActive(searchParams.get('sort') === item.slug); - }, [searchParams, item.slug]); - return (
  • Date: Fri, 28 Jul 2023 16:57:45 -0500 Subject: [PATCH 2/2] Adds anchor for v1 note (#1125) * Adds anchor for v1 note * Adds period --------- Co-authored-by: Lee Robinson --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c3fa3f6b5..9f1a06883 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,9 @@ A Next.js 13 and App Router-ready ecommerce template featuring: - Checkout and payments with Shopify - Automatic light/dark mode based on system settings -> Note: Looking for Next.js Commerce v1? View the [code](https://github.com/vercel/commerce/tree/v1), [demo](https://commerce-v1.vercel.store), and [release notes](https://github.com/vercel/commerce/releases/tag/v1) +

    + +> Note: Looking for Next.js Commerce v1? View the [code](https://github.com/vercel/commerce/tree/v1), [demo](https://commerce-v1.vercel.store), and [release notes](https://github.com/vercel/commerce/releases/tag/v1). ## Providers