@graphcommerce/framer-next-pages 3.0.1 → 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/CHANGELOG.md +65 -0
- package/components/Pages.tsx +34 -4
- package/package.json +7 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,70 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 3.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1294](https://github.com/ho-nl/m2-pwa/pull/1294)
|
|
8
|
+
[`afb993244`](https://github.com/ho-nl/m2-pwa/commit/afb993244aabc8135ce54a79743cbf63bc5677d3)
|
|
9
|
+
Thanks [@paales](https://github.com/paales)! - Make sure the fallback handles localization
|
|
10
|
+
properly
|
|
11
|
+
|
|
12
|
+
## 3.1.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [#1281](https://github.com/ho-nl/m2-pwa/pull/1281)
|
|
17
|
+
[`4bb963d75`](https://github.com/ho-nl/m2-pwa/commit/4bb963d7595b5ce6e3a4924cc2e3e8b0210cdcd6)
|
|
18
|
+
Thanks [@paales](https://github.com/paales)! - Add an option the FramerNextPages component to
|
|
19
|
+
define a fallback and fallbackRoute.
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [`973ff8645`](https://github.com/ho-nl/m2-pwa/commit/973ff86452a70ade9f4db13fdda6e963d7220e96)
|
|
24
|
+
Thanks [@paales](https://github.com/paales)! - made packages public
|
|
25
|
+
|
|
26
|
+
- Updated dependencies
|
|
27
|
+
[[`973ff8645`](https://github.com/ho-nl/m2-pwa/commit/973ff86452a70ade9f4db13fdda6e963d7220e96)]:
|
|
28
|
+
- @graphcommerce/framer-utils@3.0.3
|
|
29
|
+
|
|
30
|
+
## 3.0.2
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- [#1274](https://github.com/ho-nl/m2-pwa/pull/1274)
|
|
35
|
+
[`381e4c86a`](https://github.com/ho-nl/m2-pwa/commit/381e4c86a8321ce96e1fa5c7d3c0a0c0ff3e02c7)
|
|
36
|
+
Thanks [@paales](https://github.com/paales)! - Moved `ApolloErrorAlert`, `ApolloErrorFullPage` and
|
|
37
|
+
`ApolloErrorSnackbar` to the ecommerce-ui package.
|
|
38
|
+
|
|
39
|
+
Created `ComposedSubmitButton` and `ComposedSubmitLinkOrButton` to reduce complexity from
|
|
40
|
+
`magento-graphcms` example.
|
|
41
|
+
|
|
42
|
+
Removed dependency an `@graphcommerce/react-hook-form` from `magento-graphcms` example.
|
|
43
|
+
|
|
44
|
+
Added dependency `@graphcommerce/ecommerce-ui` from `magento-graphcms` example.
|
|
45
|
+
|
|
46
|
+
* [#1276](https://github.com/ho-nl/m2-pwa/pull/1276)
|
|
47
|
+
[`ce09388e0`](https://github.com/ho-nl/m2-pwa/commit/ce09388e0d7ef33aee660612340f6fbae15ceec2)
|
|
48
|
+
Thanks [@paales](https://github.com/paales)! - We've moved lots of internal packages from
|
|
49
|
+
`dependencies` to `peerDependencies`. The result of this is that there will be significantly less
|
|
50
|
+
duplicate packages in the node_modules folders.
|
|
51
|
+
|
|
52
|
+
- [#1276](https://github.com/ho-nl/m2-pwa/pull/1276)
|
|
53
|
+
[`52a45bba4`](https://github.com/ho-nl/m2-pwa/commit/52a45bba4dc6dd6df3c81f5023df7d23ed8a534d)
|
|
54
|
+
Thanks [@paales](https://github.com/paales)! - Upgraded to
|
|
55
|
+
[NextJS 12.1](https://nextjs.org/blog/next-12-1)! This is just for compatibility, but we'll be
|
|
56
|
+
implementing
|
|
57
|
+
[On-demand Incremental Static Regeneration](https://nextjs.org/blog/next-12-1#on-demand-incremental-static-regeneration-beta)
|
|
58
|
+
soon.
|
|
59
|
+
|
|
60
|
+
This will greatly reduce the requirement to rebuid stuff and we'll add a management UI on the
|
|
61
|
+
frontend to be able to revalidate pages manually.
|
|
62
|
+
|
|
63
|
+
- Updated dependencies
|
|
64
|
+
[[`ce09388e0`](https://github.com/ho-nl/m2-pwa/commit/ce09388e0d7ef33aee660612340f6fbae15ceec2),
|
|
65
|
+
[`52a45bba4`](https://github.com/ho-nl/m2-pwa/commit/52a45bba4dc6dd6df3c81f5023df7d23ed8a534d)]:
|
|
66
|
+
- @graphcommerce/framer-utils@3.0.2
|
|
67
|
+
|
|
3
68
|
## 3.0.1
|
|
4
69
|
|
|
5
70
|
### 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)
|
|
@@ -94,7 +100,16 @@ export default function FramerNextPages(props: PagesProps) {
|
|
|
94
100
|
// todo: implement fallback loading for up property
|
|
95
101
|
// const up = items.current[0].PageComponent.pageOptions?.up?.href ?? '/'
|
|
96
102
|
const up = '/'
|
|
97
|
-
const info = await (router as Router).getRouteInfo(
|
|
103
|
+
const info = await (router as Router).getRouteInfo(
|
|
104
|
+
fallbackRoute,
|
|
105
|
+
fallback,
|
|
106
|
+
{},
|
|
107
|
+
fallback,
|
|
108
|
+
fallback,
|
|
109
|
+
{ shallow: false },
|
|
110
|
+
router.locale,
|
|
111
|
+
false,
|
|
112
|
+
)
|
|
98
113
|
|
|
99
114
|
const pageInfo = { asPath: up, pathname: up, locale: router.locale, query: {} }
|
|
100
115
|
const Fallback = info.Component as PageComponent
|
|
@@ -113,7 +128,22 @@ export default function FramerNextPages(props: PagesProps) {
|
|
|
113
128
|
|
|
114
129
|
cancel = requestIdleCallback(() => setFallback(fbItem))
|
|
115
130
|
} catch (e) {
|
|
116
|
-
|
|
131
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
132
|
+
console.log(
|
|
133
|
+
`%cTurn on "Preseve log on navigation" to see the error`,
|
|
134
|
+
'color: blue; font-family:sans-serif; font-size: 20px',
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
console.error(
|
|
138
|
+
`@graphcommerce/framer-next-pages encountered loading the fallback.
|
|
139
|
+
This happens because the currently configured fallback '${fallback}'
|
|
140
|
+
or fallbackRoute '${fallbackRoute}' isn't correct.
|
|
141
|
+
|
|
142
|
+
Please make sure the fallbackRoute matches the filename of the index page you want to load. e.g. '/[...url]'
|
|
143
|
+
and pass it as a param in <FramerNextPages fallbackRoute='/[...url]' /> in your _app.tsx file.
|
|
144
|
+
`,
|
|
145
|
+
)
|
|
146
|
+
}
|
|
117
147
|
}
|
|
118
148
|
}
|
|
119
149
|
|
|
@@ -123,7 +153,7 @@ export default function FramerNextPages(props: PagesProps) {
|
|
|
123
153
|
return () => {
|
|
124
154
|
if (cancel) cancelIdleCallback(cancel)
|
|
125
155
|
}
|
|
126
|
-
}, [shouldLoadFb, router])
|
|
156
|
+
}, [shouldLoadFb, router, fallbackRoute, fallback])
|
|
127
157
|
|
|
128
158
|
// Add the fallback if it is available
|
|
129
159
|
if (fb && plainIdx === -1) renderItems = [fb, ...renderItems]
|
package/package.json
CHANGED
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
"name": "@graphcommerce/framer-next-pages",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "3.
|
|
5
|
+
"version": "3.1.1",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"scripts": {
|
|
8
|
-
"dev": "tsc -W"
|
|
9
|
-
},
|
|
10
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
11
8
|
"eslintConfig": {
|
|
12
9
|
"extends": "@graphcommerce/eslint-config-pwa",
|
|
@@ -15,17 +12,17 @@
|
|
|
15
12
|
}
|
|
16
13
|
},
|
|
17
14
|
"dependencies": {
|
|
18
|
-
"@graphcommerce/framer-utils": "^3.0.
|
|
15
|
+
"@graphcommerce/framer-utils": "^3.0.3"
|
|
19
16
|
},
|
|
20
17
|
"devDependencies": {
|
|
21
|
-
"@graphcommerce/eslint-config-pwa": "^4.0.
|
|
22
|
-
"@graphcommerce/prettier-config-pwa": "^4.0.
|
|
23
|
-
"@graphcommerce/typescript-config-pwa": "^4.0.
|
|
24
|
-
"@playwright/test": "^1.
|
|
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
|
+
"@playwright/test": "^1.19.1"
|
|
25
22
|
},
|
|
26
23
|
"peerDependencies": {
|
|
27
24
|
"framer-motion": "^6.2.4",
|
|
28
|
-
"next": "^12.0
|
|
25
|
+
"next": "^12.1.0",
|
|
29
26
|
"react": "^17.0.2",
|
|
30
27
|
"react-dom": "^17.0.2"
|
|
31
28
|
}
|