@@ -261,6 +261,7 @@ export function createProductHooks<
261261 skipIfCached ?: boolean
262262 } ) {
263263 const queryClient = useQueryClient ( )
264+ const region = resolveRegion ? resolveRegion ( ) : null
264265 const timeoutsRef = useRef < Map < string , ReturnType < typeof setTimeout > > > (
265266 new Map ( )
266267 )
@@ -272,7 +273,6 @@ export function createProductHooks<
272273 input : TListInput ,
273274 prefetchOptions ?: PrefetchListOptions
274275 ) => {
275- const region = resolveRegion ? resolveRegion ( ) : null
276276 const resolvedInput = applyRegion ( input , region ?? undefined )
277277 if ( requireRegion && ! resolvedInput . region_id ) {
278278 return
@@ -306,7 +306,6 @@ export function createProductHooks<
306306 input : TListInput ,
307307 prefetchOptions ?: PrefetchListOptions
308308 ) => {
309- const region = resolveRegion ? resolveRegion ( ) : null
310309 const resolvedInput = applyRegion ( input , region ?? undefined )
311310 if ( requireRegion && ! resolvedInput . region_id ) {
312311 return
@@ -341,7 +340,6 @@ export function createProductHooks<
341340 delay = defaultDelay ,
342341 prefetchId ?: string
343342 ) => {
344- const region = resolveRegion ? resolveRegion ( ) : null
345343 const resolvedInput = applyRegion ( input , region ?? undefined )
346344 const listParams = buildList ( resolvedInput )
347345 const queryKey = resolvedQueryKeys . list ( listParams )
@@ -382,6 +380,7 @@ export function createProductHooks<
382380 skipIfCached ?: boolean
383381 } ) {
384382 const queryClient = useQueryClient ( )
383+ const region = resolveRegion ? resolveRegion ( ) : null
385384 const timeoutsRef = useRef < Map < string , ReturnType < typeof setTimeout > > > (
386385 new Map ( )
387386 )
@@ -393,7 +392,6 @@ export function createProductHooks<
393392 input : TDetailInput ,
394393 prefetchOptions ?: PrefetchProductOptions
395394 ) => {
396- const region = resolveRegion ? resolveRegion ( ) : null
397395 const resolvedInput = applyRegion ( input , region ?? undefined )
398396 if ( requireRegion && ! resolvedInput . region_id ) {
399397 return
@@ -425,7 +423,6 @@ export function createProductHooks<
425423 delay = defaultDelay ,
426424 prefetchId ?: string
427425 ) => {
428- const region = resolveRegion ? resolveRegion ( ) : null
429426 const resolvedInput = applyRegion ( input , region ?? undefined )
430427 const detailParams = buildDetail ( resolvedInput )
431428 const queryKey = resolvedQueryKeys . detail ( detailParams )
0 commit comments