@depict-ai/ui 1.1.4 → 1.1.5

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.
@@ -43,7 +43,7 @@ $parcel$export(module.exports, "defaultGridSpacing", () => $a3280f0aad997933$exp
43
43
  $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$export$c3834fa86c616831);
44
44
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
45
45
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
46
- /*! Depict.ai search and product listing SDK */ const $b757f75811f3261f$export$83d89fbfd8236492 = "1.1.4";
46
+ /*! Depict.ai search and product listing SDK */ const $b757f75811f3261f$export$83d89fbfd8236492 = "1.1.5";
47
47
 
48
48
 
49
49
 
@@ -309,7 +309,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
309
309
  if (this.#supports_finalization_registry) cache_obj.finalization_registry_.register(result, body); // delete key from cache when value (WeakRefs) are collected
310
310
  else // delete things from cache after 5 minutes, so it doesn't get too heavy
311
311
  setTimeout((0, $57o7A$depictaiutilishared.catchify)(()=>delete cache_obj.cache_[body]), 300000);
312
- }), 30000 // cache values for at least 30 seconds
312
+ }), 60000 // cache values for at least 60 seconds
313
313
  );
314
314
  return result;
315
315
  } finally{
@@ -1189,6 +1189,7 @@ function $ac167f6af6a48fc3$export$a1fd619a4743ca08({ plp_results_: plp_results_
1189
1189
  const record = records[i];
1190
1190
  const { target: target , intersectionRatio: intersectionRatio } = record;
1191
1191
  const index_of_target = target_to_index_map.get(target);
1192
+ if (index_of_target == undefined) return; // It seems like it can happen that we get IntersectionObserverEntries after the onCleanup function for a recommendation card has run, in Firefox. Probably a bug in Firefox? If I understood the bug correctly, this is a workaround.
1192
1193
  const is_in_set = currently_intersecting.has(index_of_target);
1193
1194
  if (intersectionRatio > 0) {
1194
1195
  if (!is_in_set) currently_intersecting.add(index_of_target);
@@ -5108,23 +5109,30 @@ function $276380e4607fb9fb$export$6e49da55e449af7c({ scroll_restoration_data_: [
5108
5109
  ]); // get rid of old data the browser saves the old state and will restore it later on
5109
5110
  };
5110
5111
  (0, $57o7A$solidjs.createComputed)((0, $57o7A$depictaiutilishared.catchify)(()=>{
5111
- const r = get_last_result_in_viewport_();
5112
- if (r == undefined || r <= 0 || r == Infinity) return;
5112
+ const last_result = get_last_result_in_viewport_();
5113
+ if (last_result == undefined || last_result <= 0 || last_result == Infinity) return;
5114
+ if (isNaN(last_result)) {
5115
+ // if last_result is NaN there's an issue somewhere, but if we store something here that's not a number the for loop further down will break, and we won't be able to load results at all, so let's just continue
5116
+ (0, $57o7A$depictaiutilishared.report)(new Error("last_result is NaN, this should not happen"), "error", {
5117
+ last_result: last_result
5118
+ });
5119
+ return;
5120
+ }
5113
5121
  // We can push to history.state max 100 times per 30 seconds (Safari) so we have to debounce/cap this at 300ms for aggressive scrolling.
5114
5122
  // Pushing to history.state right before we leave the page (onunload etc.) is unreliable, as it has to occur *before* the next page is pushed to history.
5115
- // Instead we delay our push with a timeout set to the next acceptable interval to the previous one, when necessary
5123
+ // Instead, we delay our push with a timeout set to the next acceptable interval to the previous one, when necessary
5116
5124
  const now = +new Date();
5117
5125
  const time_since_last_ran = now - last_time_history_changed;
5118
5126
  if (time_since_last_ran > $276380e4607fb9fb$var$max_history_change_frequency) {
5119
5127
  // If the interval to the previous push is already long enough, it's fine to push the next value directly.
5120
- set_min_results_loaded(r);
5128
+ set_min_results_loaded(last_result);
5121
5129
  last_time_history_changed = now;
5122
5130
  // Even though the interval has passed, there could still be a delayed push timeout in flight (browser can delay timeouts at will).
5123
5131
  // We've already written the guaranteed-to-be-freshest value so we can just cancel it.
5124
5132
  clearTimeout(timeout);
5125
5133
  return;
5126
5134
  }
5127
- set_to_later = r;
5135
+ set_to_later = last_result;
5128
5136
  // If a delayed push timeout is already running, just changing the value that will be pushed is sufficient
5129
5137
  if (timeout) return;
5130
5138
  timeout = setTimeout((0, $57o7A$depictaiutilishared.catchify)(()=>{