@faststore/core 2.1.104 → 2.1.106

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/core",
3
- "version": "2.1.104",
3
+ "version": "2.1.106",
4
4
  "license": "MIT",
5
5
  "browserslist": "supports es6-module and not dead",
6
6
  "scripts": {
@@ -30,11 +30,11 @@
30
30
  "@envelop/graphql-jit": "^1.1.1",
31
31
  "@envelop/parser-cache": "^2.2.0",
32
32
  "@envelop/validation-cache": "^2.2.0",
33
- "@faststore/api": "^2.1.102",
34
- "@faststore/components": "^2.1.102",
35
- "@faststore/graphql-utils": "^2.1.102",
36
- "@faststore/sdk": "^2.1.102",
37
- "@faststore/ui": "^2.1.102",
33
+ "@faststore/api": "^2.1.106",
34
+ "@faststore/components": "^2.1.106",
35
+ "@faststore/graphql-utils": "^2.1.106",
36
+ "@faststore/sdk": "^2.1.106",
37
+ "@faststore/ui": "^2.1.106",
38
38
  "@types/react": "^18.0.14",
39
39
  "@vtex/client-cms": "^0.2.12",
40
40
  "autoprefixer": "^10.4.0",
@@ -61,7 +61,7 @@
61
61
  },
62
62
  "devDependencies": {
63
63
  "@cypress/code-coverage": "^3.12.1",
64
- "@faststore/eslint-config": "^2.1.102",
64
+ "@faststore/eslint-config": "^2.1.106",
65
65
  "@faststore/lighthouse": "^1.12.32",
66
66
  "@graphql-codegen/cli": "^2.6.2",
67
67
  "@graphql-codegen/typescript": "^2.5.1",
@@ -110,5 +110,5 @@
110
110
  "msw": {
111
111
  "workerDirectory": "public"
112
112
  },
113
- "gitHead": "37296643dfa2d1f0b710e55f188cc6a480f9dd37"
113
+ "gitHead": "c1b21a901e670f739ad1667552fbe57df9935d16"
114
114
  }
@@ -1,5 +1,5 @@
1
1
  import type { ChangeEvent } from 'react'
2
- import { useCallback, useEffect, useReducer } from 'react'
2
+ import { useCallback, useEffect, useReducer, useRef } from 'react'
3
3
  import { ShippingSimulationProps as UIShippingSimulationProps } from '@faststore/components'
4
4
 
5
5
  export interface ProductShippingInfo {
@@ -123,9 +123,11 @@ export const useShippingSimulation = (
123
123
  )
124
124
 
125
125
  const { postalCode: shippingPostalCode } = input
126
+ const shippingPostalCodeRef = useRef(shippingPostalCode)
126
127
 
127
128
  useEffect(() => {
128
- if (!sessionPostalCode || shippingPostalCode) {
129
+ const shouldFetch = sessionPostalCode && !shippingPostalCodeRef.current
130
+ if (!shouldFetch) {
129
131
  return
130
132
  }
131
133
 
@@ -154,13 +156,7 @@ export const useShippingSimulation = (
154
156
  }
155
157
 
156
158
  fetchShipping()
157
- }, [
158
- country,
159
- fetchShippingSimulationFn,
160
- sessionPostalCode,
161
- shippingItem,
162
- shippingPostalCode,
163
- ])
159
+ }, [country, fetchShippingSimulationFn, sessionPostalCode, shippingItem])
164
160
 
165
161
  const handleSubmit = useCallback(async () => {
166
162
  try {