@graphcommerce/framer-next-pages 3.0.2 → 3.1.0
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/CHANGELOG.md +18 -0
- package/components/Pages.tsx +12 -6
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 3.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1281](https://github.com/ho-nl/m2-pwa/pull/1281)
|
|
8
|
+
[`4bb963d75`](https://github.com/ho-nl/m2-pwa/commit/4bb963d7595b5ce6e3a4924cc2e3e8b0210cdcd6)
|
|
9
|
+
Thanks [@paales](https://github.com/paales)! - Add an option the FramerNextPages component to
|
|
10
|
+
define a fallback and fallbackRoute.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`973ff8645`](https://github.com/ho-nl/m2-pwa/commit/973ff86452a70ade9f4db13fdda6e963d7220e96)
|
|
15
|
+
Thanks [@paales](https://github.com/paales)! - made packages public
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
[[`973ff8645`](https://github.com/ho-nl/m2-pwa/commit/973ff86452a70ade9f4db13fdda6e963d7220e96)]:
|
|
19
|
+
- @graphcommerce/framer-utils@3.0.3
|
|
20
|
+
|
|
3
21
|
## 3.0.2
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/components/Pages.tsx
CHANGED
|
@@ -15,6 +15,12 @@ function findPlainIdx(items: PageItem[]) {
|
|
|
15
15
|
type PagesProps = Omit<AppPropsType<NextRouter>, 'pageProps' | 'Component'> & {
|
|
16
16
|
Component: PageComponent
|
|
17
17
|
pageProps?: { up?: UpPage | null }
|
|
18
|
+
|
|
19
|
+
/** Fallback URL that is loaded when there is no page available behind the current overlay */
|
|
20
|
+
fallback?: `/${string}`
|
|
21
|
+
|
|
22
|
+
/** The path to the route-file */
|
|
23
|
+
fallbackRoute?: `/${string}`
|
|
18
24
|
}
|
|
19
25
|
|
|
20
26
|
function getPageInfo(router: NextRouter) {
|
|
@@ -35,7 +41,7 @@ function getPageInfo(router: NextRouter) {
|
|
|
35
41
|
// }
|
|
36
42
|
|
|
37
43
|
export default function FramerNextPages(props: PagesProps) {
|
|
38
|
-
const { router, Component, pageProps: incomingProps } = props
|
|
44
|
+
const { router, Component, pageProps: incomingProps, fallback = '/', fallbackRoute = '/' } = props
|
|
39
45
|
|
|
40
46
|
const items = useRef<PageItem[]>([])
|
|
41
47
|
const idx = Number(global.window?.history.state?.idx ?? 0)
|
|
@@ -95,11 +101,11 @@ export default function FramerNextPages(props: PagesProps) {
|
|
|
95
101
|
// const up = items.current[0].PageComponent.pageOptions?.up?.href ?? '/'
|
|
96
102
|
const up = '/'
|
|
97
103
|
const info = await (router as Router).getRouteInfo(
|
|
98
|
-
|
|
99
|
-
|
|
104
|
+
fallbackRoute,
|
|
105
|
+
fallback,
|
|
100
106
|
{},
|
|
101
|
-
|
|
102
|
-
|
|
107
|
+
fallback,
|
|
108
|
+
fallback,
|
|
103
109
|
{ shallow: false },
|
|
104
110
|
undefined,
|
|
105
111
|
false,
|
|
@@ -132,7 +138,7 @@ export default function FramerNextPages(props: PagesProps) {
|
|
|
132
138
|
return () => {
|
|
133
139
|
if (cancel) cancelIdleCallback(cancel)
|
|
134
140
|
}
|
|
135
|
-
}, [shouldLoadFb, router])
|
|
141
|
+
}, [shouldLoadFb, router, fallbackRoute, fallback])
|
|
136
142
|
|
|
137
143
|
// Add the fallback if it is available
|
|
138
144
|
if (fb && plainIdx === -1) renderItems = [fb, ...renderItems]
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/framer-next-pages",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "3.0
|
|
5
|
+
"version": "3.1.0",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@graphcommerce/framer-utils": "^3.0.
|
|
15
|
+
"@graphcommerce/framer-utils": "^3.0.3"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@graphcommerce/eslint-config-pwa": "^4.0.
|
|
19
|
-
"@graphcommerce/prettier-config-pwa": "^4.0.
|
|
20
|
-
"@graphcommerce/typescript-config-pwa": "^4.0.
|
|
18
|
+
"@graphcommerce/eslint-config-pwa": "^4.0.3",
|
|
19
|
+
"@graphcommerce/prettier-config-pwa": "^4.0.2",
|
|
20
|
+
"@graphcommerce/typescript-config-pwa": "^4.0.2",
|
|
21
21
|
"@playwright/test": "^1.19.1"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|