@graphcommerce/magento-customer 4.11.6 → 4.11.7

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.11.7
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`1f2e14ba8`](https://github.com/graphcommerce-org/graphcommerce/commit/1f2e14ba8b674b87257a123e8cb215157890eb22), [`fc32b9ab3`](https://github.com/graphcommerce-org/graphcommerce/commit/fc32b9ab3818eb99c546a89e7f42045a6fbfba81)]:
8
+ - @graphcommerce/react-hook-form@3.3.5
9
+ - @graphcommerce/ecommerce-ui@1.5.3
10
+
3
11
  ## 4.11.6
4
12
 
5
13
  ### Patch Changes
@@ -16,12 +16,24 @@ export type UseCustomerSessionReturn =
16
16
  query: QueryResult<CustomerTokenQuery, CustomerTokenQueryVariables>
17
17
  } & Partial<Omit<NonNullable<CustomerTokenQuery['customerToken']>, '__typename'>>
18
18
 
19
- export function useCustomerSession(
20
- options: UseCustomerSessionOptions = {},
21
- ): UseCustomerSessionReturn {
19
+ export function useCustomerSession(options: UseCustomerSessionOptions = {}) {
20
+ /**
21
+ * We current always assume the initial render is during hydration.
22
+ *
23
+ * How can we determine we're not actually hydrating? Classically you could just use some global
24
+ * state to track this because when the initial render is done, we're not hydrating anymore.
25
+ *
26
+ * However, <Suspense/> can be used to defer the rendering to a later moment. This means that the
27
+ * useCustomerSession hook is called later and we're still in the hydration phase for this
28
+ * component while other components are rendering for the second time.
29
+ */
22
30
  const { hydration = false } = options
23
31
  const [hydrating, setHydrating] = useState(!hydration)
24
32
 
33
+ /**
34
+ * After the initital render we are definitely sure we're not hydrating anymore so we can flip the
35
+ * switch and rerender.
36
+ */
25
37
  useIsomorphicLayoutEffect(() => startTransition(() => setHydrating(false)), [])
26
38
 
27
39
  const skip = hydrating
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-customer",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "4.11.6",
5
+ "version": "4.11.7",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -19,7 +19,7 @@
19
19
  "type-fest": "^2.12.2"
20
20
  },
21
21
  "dependencies": {
22
- "@graphcommerce/ecommerce-ui": "1.5.2",
22
+ "@graphcommerce/ecommerce-ui": "1.5.3",
23
23
  "@graphcommerce/framer-utils": "3.2.0",
24
24
  "@graphcommerce/graphql": "3.4.8",
25
25
  "@graphcommerce/graphql-mesh": "4.2.0",
@@ -27,7 +27,7 @@
27
27
  "@graphcommerce/magento-graphql": "3.1.8",
28
28
  "@graphcommerce/magento-store": "4.3.1",
29
29
  "@graphcommerce/next-ui": "4.28.0",
30
- "@graphcommerce/react-hook-form": "3.3.4"
30
+ "@graphcommerce/react-hook-form": "3.3.5"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@lingui/react": "^3.13.2",