Skip to content

Commit

Permalink
feat: remove fetcherOffer export and related preload calls in useProd…
Browse files Browse the repository at this point in the history
…uctLink
  • Loading branch information
emersonlaurentino committed Dec 4, 2024
1 parent 59bb4dc commit cf0d0bf
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/sdk/offer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { aggregateOffer } from './aggregate'
import { enhanceCommercialOffer } from './enhance'
import { fetcher } from './fetcher'
import { bestOfferFirst } from './sort'
export { fetcher as fetcherOffer, getUrl as getOfferUrl } from './fetcher'
export { getUrl as getOfferUrl } from './fetcher'

const ERROR_DATA = { offers: {}, isValidating: false }

Expand Down
8 changes: 0 additions & 8 deletions packages/core/src/sdk/product/useProductLink.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import type { CurrencyCode, SelectItemEvent } from '@faststore/sdk'
import type { ProductSummary_ProductFragment } from '@generated/graphql'
import { useCallback } from 'react'
import { preload } from 'swr'
import type { AnalyticsItem, SearchSelectItemEvent } from '../analytics/types'
import { fetcherOffer } from '../offer'
import { useSession } from '../session'

export type ProductLinkOptions = {
Expand Down Expand Up @@ -65,12 +63,6 @@ export const useProductLink = ({
return {
href: `/${slug}/p`,
onClick,
onMouseDown: () => {
preload(product.sku, fetcherOffer)
},
onTouchStart: () => {
preload(product.sku, fetcherOffer)
},
'data-testid': 'product-link',
}
}

0 comments on commit cf0d0bf

Please sign in to comment.