@pradip1995/segment-animation-shop-grid 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pradip1995/segment-animation-shop-grid",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"next": ">=15"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@pradip1995/segment-primitives": "^0.4.
|
|
28
|
-
"@pradip1995/segment-product-card": "^0.3.
|
|
29
|
-
"@pradip1995/segment-tokens": "^0.3.
|
|
27
|
+
"@pradip1995/segment-primitives": "^0.4.11",
|
|
28
|
+
"@pradip1995/segment-product-card": "^0.3.26",
|
|
29
|
+
"@pradip1995/segment-tokens": "^0.3.14",
|
|
30
30
|
"framer-motion": "^12.0.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
@@ -9,6 +9,7 @@ import { loadMoreStoreProducts, type StoreLoadMoreFilters } from "./load-more-pr
|
|
|
9
9
|
import "./animation-shop-grid.css"
|
|
10
10
|
|
|
11
11
|
const PAGE_SIZE = 12
|
|
12
|
+
const EMPTY_PRODUCTS: HttpTypes.StoreProduct[] = []
|
|
12
13
|
|
|
13
14
|
const SORT_OPTIONS = [
|
|
14
15
|
{ value: "created_at_desc", label: "Newest" },
|
|
@@ -240,7 +241,7 @@ export default function AnimationShopGrid(props: {
|
|
|
240
241
|
props.maxPrice,
|
|
241
242
|
]
|
|
242
243
|
)
|
|
243
|
-
const initialProducts = props.products ??
|
|
244
|
+
const initialProducts = props.products ?? EMPTY_PRODUCTS
|
|
244
245
|
const totalCount = props.productCount ?? initialProducts.length
|
|
245
246
|
|
|
246
247
|
const [items, setItems] = useState(initialProducts)
|
|
@@ -255,12 +256,12 @@ export default function AnimationShopGrid(props: {
|
|
|
255
256
|
const loadingRef = useRef(false)
|
|
256
257
|
|
|
257
258
|
useEffect(() => {
|
|
258
|
-
setItems(props.products ??
|
|
259
|
+
setItems(props.products ?? EMPTY_PRODUCTS)
|
|
259
260
|
setCurrentPage(initialPage)
|
|
260
261
|
setHasMore(sortBy !== "bestsellers" && totalCount > initialPage * PAGE_SIZE)
|
|
261
262
|
setLoadError(null)
|
|
262
263
|
loadingRef.current = false
|
|
263
|
-
}, [filterSignature, initialPage, sortBy, totalCount])
|
|
264
|
+
}, [filterSignature, initialPage, sortBy, totalCount, props.products])
|
|
264
265
|
|
|
265
266
|
const loadNextPage = useCallback(() => {
|
|
266
267
|
if (loadingRef.current || pending || !hasMore || sortBy === "bestsellers") return
|