sr-npm 1.7.287 → 1.7.289

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": "sr-npm",
3
- "version": "1.7.287",
3
+ "version": "1.7.289",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -338,21 +338,26 @@ async function handleLocationParam(_$w,location) {
338
338
  console.log("location dropdown options:", dropdownOptions);
339
339
  const optionsFromCMS=await wixData.query("cities").find();
340
340
  //+1 because of the "All" option
341
-
342
341
  if(dropdownOptions.length!==optionsFromCMS.items.length+1){
343
342
  fixDropdownOptions('#dropdownLocation',optionsFromCMS, _$w);
344
343
  }
344
+ console.log("dropdown options after fix: ", _$w('#dropdownLocation').options);
345
345
 
346
- if (_$w('#dropdownLocation').options.find(option => option.value === locationValue))
347
- {
348
- _$w('#dropdownLocation').value = locationValue;
349
- console.log("i am here!@@##!@#")
350
- await applyFilters(_$w, true); // Skip URL update since we're handling initial URL params
351
- }
352
- else{
353
- console.warn("location value not found in dropdown options");
354
- queryParams.remove(["location" ]);
346
+ let appliedFilter=false;
355
347
 
348
+ _$w('#dropdownLocation').options.find(async (option) =>
349
+ {
350
+ if (option.value.toLowerCase() === locationValue.toLowerCase()){
351
+ appliedFilter=true;
352
+ console.log("option value is: ", option);
353
+ _$w('#dropdownLocation').value = option.value;
354
+ console.log("i am here!@@##!@#")
355
+ await applyFilters(_$w, true); // Skip URL
356
+ }
357
+ })
358
+ if (!appliedFilter) {
359
+ console.warn("location value not found in dropdown options");
360
+ queryParams.remove(["location"]);
356
361
  }
357
362
 
358
363
  }