@graphcommerce/ecommerce-ui 1.1.3 → 1.1.6

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,28 @@
1
1
  # @graphcommerce/ecommerce-ui
2
2
 
3
+ ## 1.1.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`a88f166f0`](https://github.com/graphcommerce-org/graphcommerce/commit/a88f166f0115c58254fe47171da51a5850658a32)]:
8
+ - @graphcommerce/next-ui@4.15.1
9
+
10
+ ## 1.1.5
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [[`e167992df`](https://github.com/graphcommerce-org/graphcommerce/commit/e167992dfdc6964a392af719667f8a188626ab1b), [`9c2504b4e`](https://github.com/graphcommerce-org/graphcommerce/commit/9c2504b4ed75f41d3003c4d3339814010e85e37e)]:
15
+ - @graphcommerce/next-ui@4.15.0
16
+
17
+ ## 1.1.4
18
+
19
+ ### Patch Changes
20
+
21
+ - [#1557](https://github.com/graphcommerce-org/graphcommerce/pull/1557) [`c0a7f9427`](https://github.com/graphcommerce-org/graphcommerce/commit/c0a7f9427466f0a3886b2c3ebf2f0aa5d79ee081) Thanks [@paales](https://github.com/paales)! - WaitForQueries already handles the SSR loading, no need for NoSSR
22
+
23
+ - Updated dependencies [[`01f1588c9`](https://github.com/graphcommerce-org/graphcommerce/commit/01f1588c9200bb39dd61146e260bfa2b32060612)]:
24
+ - @graphcommerce/graphql@3.4.3
25
+
3
26
  ## 1.1.3
4
27
 
5
28
  ### Patch Changes
@@ -1,10 +1,11 @@
1
1
  import { useIsomorphicLayoutEffect } from '@graphcommerce/framer-utils'
2
2
  import { QueryResult } from '@graphcommerce/graphql'
3
- import { NoSsr, NoSsrProps } from '@mui/material'
4
- import { useState } from 'react'
3
+ import React, { startTransition, useState } from 'react'
5
4
 
6
- export type WaitForQueriesProps = Omit<NoSsrProps, 'defer'> & {
5
+ export type WaitForQueriesProps = {
7
6
  waitFor: QueryResult<any, any> | QueryResult<any, any>[]
7
+ children: React.ReactNode
8
+ fallback?: React.ReactNode
8
9
  }
9
10
 
10
11
  /**
@@ -14,11 +15,15 @@ export type WaitForQueriesProps = Omit<NoSsrProps, 'defer'> & {
14
15
  */
15
16
  export const WaitForQueries = (props: WaitForQueriesProps) => {
16
17
  const { waitFor, fallback, children } = props
17
- const queries = Array.isArray(waitFor) ? waitFor : [waitFor]
18
- const isDone = queries.every(({ data, error }) => data || error)
19
18
 
19
+ // We are done when all queries either have data or an error
20
+ const isDone = (Array.isArray(waitFor) ? waitFor : [waitFor]).every(
21
+ ({ data, error }) => data || error,
22
+ )
23
+
24
+ // Wait for the queries to finish
20
25
  const [mountedState, setMountedState] = useState(false)
21
- useIsomorphicLayoutEffect(() => setMountedState(true), [])
26
+ useIsomorphicLayoutEffect(() => startTransition(() => setMountedState(true)), [])
22
27
 
23
- return <NoSsr fallback={fallback}>{isDone && mountedState ? children : fallback}</NoSsr>
28
+ return <>{isDone && mountedState ? children : fallback}</>
24
29
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/ecommerce-ui",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "1.1.3",
5
+ "version": "1.1.6",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -13,9 +13,9 @@
13
13
  },
14
14
  "dependencies": {
15
15
  "@graphcommerce/framer-utils": "3.1.4",
16
- "@graphcommerce/next-ui": "4.14.0",
16
+ "@graphcommerce/next-ui": "4.15.1",
17
17
  "@graphcommerce/react-hook-form": "3.3.1",
18
- "@graphcommerce/graphql": "3.4.2"
18
+ "@graphcommerce/graphql": "3.4.3"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@graphcommerce/eslint-config-pwa": "^4.1.9",