@faststore/core 3.1.0 → 3.1.1
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/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +13 -13
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/config.json +3 -3
- package/.next/cache/eslint/.cache_1gneedd +1 -1
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/next-minimal-server.js.nft.json +1 -1
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.js +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/react-loadable-manifest.json +1 -1
- package/.next/routes-manifest.json +1 -1
- package/.next/server/chunks/8096.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/pages/en-US/404.html +1 -1
- package/.next/server/pages/en-US/500.html +1 -1
- package/.next/server/pages/en-US/account.html +1 -1
- package/.next/server/pages/en-US/checkout.html +1 -1
- package/.next/server/pages/en-US/login.html +1 -1
- package/.next/server/pages/en-US/s.html +1 -1
- package/.next/server/pages/en-US.html +1 -1
- package/.next/server/pages-manifest.json +1 -1
- package/.next/static/chunks/{2032.a5d5d24fee696f7e.js → 2032.5cd9c0854edb6b16.js} +1 -1
- package/.next/static/chunks/{webpack-c139db73ca37b6f3.js → webpack-5c2cbf0d104592ed.js} +1 -1
- package/.next/trace +97 -97
- package/.turbo/turbo-build.log +2 -2
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-test.log +5 -5
- package/CHANGELOG.md +6 -0
- package/package.json +2 -2
- package/src/components/product/ProductGrid/ProductGrid.tsx +5 -4
- package/src/components/ui/ProductGallery/ProductGalleryPage.tsx +7 -8
- package/src/sdk/search/Sentinel.tsx +15 -9
- /package/.next/static/{aVo0RZ1_279AVZSq19y5i → RvBOab6zYvdJhM_64bb4B}/_buildManifest.js +0 -0
- /package/.next/static/{aVo0RZ1_279AVZSq19y5i → RvBOab6zYvdJhM_64bb4B}/_ssgManifest.js +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -68,11 +68,11 @@ Route (pages) Size First Load JS
|
|
|
68
68
|
├ chunks/framework-12a146e94cfcf7c4.js 45.4 kB
|
|
69
69
|
├ chunks/main-209ac4974b020af1.js 33.1 kB
|
|
70
70
|
├ chunks/pages/_app-e419b2062065ccf0.js 9.87 kB
|
|
71
|
-
├ chunks/webpack-
|
|
71
|
+
├ chunks/webpack-5c2cbf0d104592ed.js 3.39 kB
|
|
72
72
|
└ css/ee0556daedda6306.css 3.07 kB
|
|
73
73
|
|
|
74
74
|
λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
|
|
75
75
|
○ (Static) automatically rendered as static HTML (uses no initial props)
|
|
76
76
|
● (SSG) automatically generated as static HTML + JSON (uses getStaticProps)
|
|
77
77
|
|
|
78
|
-
Done in
|
|
78
|
+
Done in 71.48s.
|
package/.turbo/turbo-lint.log
CHANGED
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
yarn run v1.22.22
|
|
2
2
|
$ jest
|
|
3
|
-
PASS test/
|
|
4
|
-
PASS test/
|
|
5
|
-
PASS test/server/index.test.ts (
|
|
3
|
+
PASS test/utils/multipleTemplates.test.ts (36.798 s)
|
|
4
|
+
PASS test/server/cms/index.test.ts (36.975 s)
|
|
5
|
+
PASS test/server/index.test.ts (40.537 s)
|
|
6
6
|
|
|
7
7
|
Test Suites: 3 passed, 3 total
|
|
8
8
|
Tests: 19 passed, 19 total
|
|
9
9
|
Snapshots: 0 total
|
|
10
|
-
Time:
|
|
10
|
+
Time: 41.618 s
|
|
11
11
|
Ran all test suites.
|
|
12
|
-
Done in
|
|
12
|
+
Done in 43.53s.
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.1.1](https://github.com/vtex/faststore/compare/v3.1.0...v3.1.1) (2024-12-09)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- `Sentinel` rendering and wrong PLP's pagination behavior ([#2585](https://github.com/vtex/faststore/issues/2585)) ([ea59e77](https://github.com/vtex/faststore/commit/ea59e77fccee7866bd4e44b73e855dd5cee4ba6e)), closes [vtex-sites/starter.store#630](https://github.com/vtex-sites/starter.store/issues/630)
|
|
11
|
+
|
|
6
12
|
# [3.1.0](https://github.com/vtex/faststore/compare/v3.0.160...v3.1.0) (2024-12-09)
|
|
7
13
|
|
|
8
14
|
### Features
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/core",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "vtex/faststore",
|
|
6
6
|
"browserslist": "supports es6-module and not dead",
|
|
@@ -128,5 +128,5 @@
|
|
|
128
128
|
"node": "18.19.0",
|
|
129
129
|
"yarn": "1.19.1"
|
|
130
130
|
},
|
|
131
|
-
"gitHead": "
|
|
131
|
+
"gitHead": "632f3d65acbb92223571ab3789b23a96d363e6b5"
|
|
132
132
|
}
|
|
@@ -9,6 +9,7 @@ import { ProductCardProps } from '../ProductCard'
|
|
|
9
9
|
import { memo } from 'react'
|
|
10
10
|
import ViewportObserver from 'src/components/cms/ViewportObserver'
|
|
11
11
|
import { useOverrideComponents } from 'src/sdk/overrides/OverrideContext'
|
|
12
|
+
import useScreenResize from 'src/sdk/ui/useScreenResize'
|
|
12
13
|
|
|
13
14
|
interface Props {
|
|
14
15
|
/**
|
|
@@ -45,12 +46,12 @@ function ProductGrid({
|
|
|
45
46
|
} = {},
|
|
46
47
|
firstPage,
|
|
47
48
|
}: Props) {
|
|
49
|
+
const { isMobile } = useScreenResize()
|
|
48
50
|
const { __experimentalProductCard: ProductCard } =
|
|
49
51
|
useOverrideComponents<'ProductGallery'>()
|
|
50
|
-
const aspectRatio = 1
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
const
|
|
53
|
+
const aspectRatio = 1
|
|
54
|
+
const isGridWithViewportObserver = isMobile && firstPage === page
|
|
54
55
|
|
|
55
56
|
return (
|
|
56
57
|
<ProductGridSkeleton
|
|
@@ -58,7 +59,7 @@ function ProductGrid({
|
|
|
58
59
|
loading={products.length === 0}
|
|
59
60
|
>
|
|
60
61
|
<UIProductGrid>
|
|
61
|
-
{
|
|
62
|
+
{isGridWithViewportObserver ? (
|
|
62
63
|
<>
|
|
63
64
|
{products.slice(0, 2).map(({ node: product }, idx) => (
|
|
64
65
|
<UIProductGridItem key={`${product.id}`}>
|
|
@@ -28,13 +28,12 @@ function ProductGalleryPage({
|
|
|
28
28
|
const products = data?.search?.products?.edges ?? []
|
|
29
29
|
|
|
30
30
|
return (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
/>
|
|
31
|
+
<Sentinel
|
|
32
|
+
products={products}
|
|
33
|
+
page={page}
|
|
34
|
+
pageSize={itemsPerPage}
|
|
35
|
+
title={title}
|
|
36
|
+
>
|
|
38
37
|
<ProductGrid
|
|
39
38
|
products={products}
|
|
40
39
|
page={page}
|
|
@@ -42,7 +41,7 @@ function ProductGalleryPage({
|
|
|
42
41
|
productCard={productCard}
|
|
43
42
|
firstPage={firstPage}
|
|
44
43
|
/>
|
|
45
|
-
|
|
44
|
+
</Sentinel>
|
|
46
45
|
)
|
|
47
46
|
}
|
|
48
47
|
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { useSearch } from '@faststore/sdk'
|
|
2
|
-
import { useEffect, useRef } from 'react'
|
|
2
|
+
import { useEffect, useRef, type PropsWithChildren } from 'react'
|
|
3
3
|
import { useInView } from 'react-intersection-observer'
|
|
4
4
|
import type { NextRouter } from 'next/router'
|
|
5
5
|
import { useRouter } from 'next/router'
|
|
6
6
|
|
|
7
7
|
import type { ProductSummary_ProductFragment } from '@generated/graphql'
|
|
8
8
|
|
|
9
|
+
import useScreenResize from 'src/sdk/ui/useScreenResize'
|
|
9
10
|
import { useViewItemListEvent } from '../analytics/hooks/useViewItemListEvent'
|
|
10
11
|
|
|
11
|
-
interface
|
|
12
|
+
interface SentinelProps {
|
|
12
13
|
page: number
|
|
13
14
|
pageSize: number
|
|
14
15
|
title: string
|
|
@@ -38,19 +39,24 @@ const replacePagination = (page: string, router: NextRouter) => {
|
|
|
38
39
|
* Also, this component's name is kind of curious. Wikipedia calls is Page Break(https://en.wikipedia.org/wiki/Page_break)
|
|
39
40
|
* however all codes I've seen online use Sentinel
|
|
40
41
|
*/
|
|
41
|
-
function Sentinel({
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
function Sentinel({
|
|
43
|
+
page,
|
|
44
|
+
pageSize,
|
|
45
|
+
products,
|
|
46
|
+
title,
|
|
47
|
+
children,
|
|
48
|
+
}: PropsWithChildren<SentinelProps>) {
|
|
46
49
|
const router = useRouter()
|
|
47
|
-
|
|
50
|
+
const { pages } = useSearch()
|
|
51
|
+
const { isMobile } = useScreenResize()
|
|
52
|
+
const { ref, inView } = useInView({ threshold: isMobile ? 0.3 : 0.7 })
|
|
48
53
|
const { sendViewItemListEvent } = useViewItemListEvent({
|
|
49
54
|
products,
|
|
50
55
|
title,
|
|
51
56
|
page,
|
|
52
57
|
pageSize,
|
|
53
58
|
})
|
|
59
|
+
const viewedRef = useRef(false)
|
|
54
60
|
|
|
55
61
|
useEffect(() => {
|
|
56
62
|
// Only replace pagination state when infinite scroll
|
|
@@ -72,7 +78,7 @@ function Sentinel({ page, pageSize, products, title }: Props) {
|
|
|
72
78
|
products.length,
|
|
73
79
|
])
|
|
74
80
|
|
|
75
|
-
return <div ref={ref}
|
|
81
|
+
return <div ref={ref}>{children}</div>
|
|
76
82
|
}
|
|
77
83
|
|
|
78
84
|
export default Sentinel
|
|
File without changes
|
|
File without changes
|