@graphcommerce/magento-compare 8.0.6-canary.4 → 8.0.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,19 +1,6 @@
1
1
  # @graphcommerce/magento-compare
2
2
 
3
- ## 8.0.6-canary.4
4
-
5
- ## 8.0.6-canary.3
6
-
7
- ## 8.0.6-canary.2
8
-
9
- ### Patch Changes
10
-
11
- - [#2234](https://github.com/graphcommerce-org/graphcommerce/pull/2234) [`530076e`](https://github.com/graphcommerce-org/graphcommerce/commit/530076e3664703cb8b577b7fcf1998a420819f60) - Moved all usages of useFormPersist to the <FormPersist/> component to prevent rerenders.
12
- ([@FrankHarland](https://github.com/FrankHarland))
13
-
14
- ## 8.0.6-canary.1
15
-
16
- ## 8.0.6-canary.0
3
+ ## 8.0.6
17
4
 
18
5
  ## 8.0.5
19
6
 
@@ -1,4 +1,4 @@
1
- import { FormPersist, useForm, UseFormReturn, useWatch } from '@graphcommerce/ecommerce-ui'
1
+ import { useForm, useFormPersist, UseFormReturn, useWatch } from '@graphcommerce/ecommerce-ui'
2
2
  import { filterNonNullableKeys, nonNullable } from '@graphcommerce/next-ui'
3
3
  import React, { createContext, useContext, useEffect, useMemo, useRef } from 'react'
4
4
  import { useCompareList } from '../hooks'
@@ -25,6 +25,7 @@ export function CompareListForm(props: CompareListFormProps) {
25
25
  defaultValues: { selected: [...Array(gridColumns).keys()] },
26
26
  })
27
27
 
28
+ useFormPersist({ form, name: 'CompareList', storage: 'localStorage' })
28
29
  const selectedState = form.watch('selected')
29
30
  const selectedPrevious = useRef<number[]>(selectedState)
30
31
  const compareAbleItems = compareListData?.compareList?.items
@@ -59,15 +60,10 @@ export function CompareListForm(props: CompareListFormProps) {
59
60
  }, [compareAbleItems?.length, compareListCount, form, gridColumns, selectedState])
60
61
 
61
62
  const value = useMemo(
62
- () => ({ ...form, selectedPrevious }) satisfies CompareFormContextType,
63
+ () => ({ ...form, selectedPrevious } satisfies CompareFormContextType),
63
64
  [form],
64
65
  )
65
- return (
66
- <CompareFormContext.Provider value={value}>
67
- <FormPersist form={form} name='CompareList' />
68
- {children}
69
- </CompareFormContext.Provider>
70
- )
66
+ return <CompareFormContext.Provider value={value}>{children}</CompareFormContext.Provider>
71
67
  }
72
68
 
73
69
  export function useCompareForm() {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-compare",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "8.0.6-canary.4",
5
+ "version": "8.0.6",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,16 +12,16 @@
12
12
  }
13
13
  },
14
14
  "peerDependencies": {
15
- "@graphcommerce/ecommerce-ui": "^8.0.6-canary.4",
16
- "@graphcommerce/eslint-config-pwa": "^8.0.6-canary.4",
17
- "@graphcommerce/framer-next-pages": "^8.0.6-canary.4",
18
- "@graphcommerce/framer-utils": "^8.0.6-canary.4",
19
- "@graphcommerce/graphql": "^8.0.6-canary.4",
20
- "@graphcommerce/magento-cart": "^8.0.6-canary.4",
21
- "@graphcommerce/magento-product": "^8.0.6-canary.4",
22
- "@graphcommerce/next-ui": "^8.0.6-canary.4",
23
- "@graphcommerce/prettier-config-pwa": "^8.0.6-canary.4",
24
- "@graphcommerce/typescript-config-pwa": "^8.0.6-canary.4",
15
+ "@graphcommerce/ecommerce-ui": "^8.0.6",
16
+ "@graphcommerce/eslint-config-pwa": "^8.0.6",
17
+ "@graphcommerce/framer-next-pages": "^8.0.6",
18
+ "@graphcommerce/framer-utils": "^8.0.6",
19
+ "@graphcommerce/graphql": "^8.0.6",
20
+ "@graphcommerce/magento-cart": "^8.0.6",
21
+ "@graphcommerce/magento-product": "^8.0.6",
22
+ "@graphcommerce/next-ui": "^8.0.6",
23
+ "@graphcommerce/prettier-config-pwa": "^8.0.6",
24
+ "@graphcommerce/typescript-config-pwa": "^8.0.6",
25
25
  "@lingui/core": "^4.2.1",
26
26
  "@lingui/macro": "^4.2.1",
27
27
  "@lingui/react": "^4.2.1",