@pack/hydrogen 3.2.3 → 3.2.4

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/dist/index.js CHANGED
@@ -6382,7 +6382,9 @@ function createPackClient(options) {
6382
6382
  queryVariables.language = i18n.language;
6383
6383
  queryVariables.country = i18n.country;
6384
6384
  }
6385
- if (packClient && token && !testInfoForRequest && currentRequest) {
6385
+ const explicitTest = testFromQueryParams || test;
6386
+ const resolveTestInfo = !previewEnabled && !explicitTest;
6387
+ if (resolveTestInfo && packClient && token && !testInfoForRequest && currentRequest) {
6386
6388
  try {
6387
6389
  if (!testInfoPromise) {
6388
6390
  debug4(
@@ -6415,20 +6417,19 @@ function createPackClient(options) {
6415
6417
  testInfoForRequest = void 0;
6416
6418
  testInfoPromise = void 0;
6417
6419
  }
6418
- } else if (packClient && token && testInfoForRequest) {
6420
+ } else if (resolveTestInfo && packClient && token && testInfoForRequest) {
6419
6421
  debug4("[Pack Test] Using cached testInfo - subsequent query");
6420
6422
  if (process.env.NODE_ENV === "development") {
6421
6423
  console.log("[Pack Test] Using cached testInfo - subsequent query");
6422
6424
  }
6423
6425
  }
6424
- if (testInfoForRequest?.isFirstExposure) {
6426
+ if (resolveTestInfo && testInfoForRequest?.isFirstExposure) {
6425
6427
  const { isFirstExposure: _isFirstExposure, ...testInfo } = testInfoForRequest;
6426
6428
  testInfoForLoader = testInfo;
6427
6429
  }
6428
6430
  headers = setTestHeaders(headers, {
6429
- previewEnabled,
6430
6431
  testInfoForRequest,
6431
- testFromQueryParams: testFromQueryParams || test
6432
+ testFromQueryParams: explicitTest
6432
6433
  });
6433
6434
  if (previewEnabled) {
6434
6435
  try {