sr-npm 1.7.150 → 1.7.152

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.150",
3
+ "version": "1.7.152",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -265,12 +265,22 @@ async function handleDepartmentParam(_$w,department) {
265
265
  // Debug: Check dropdown options
266
266
 
267
267
  console.log("after refresh");
268
- const dropdownOptions = _$w('#dropdownDepartment').options;
268
+ let dropdownOptions = _$w('#dropdownDepartment').options;
269
269
  console.log("dropdown options:", dropdownOptions);
270
270
  const optionsFromCMS=await wixData.query("AmountOfJobsPerDepartment").find();
271
271
  //+1 because of the "All" option
272
+
272
273
  if(dropdownOptions.length!==optionsFromCMS.items.length+1){
273
- throw new Error("dropdownOptions.length!==optionsFromCMS.items.length");
274
+
275
+ dropdownOptions={
276
+ label: "All",
277
+ value: "RESET_ALL"
278
+ }
279
+ dropdownOptions.push(...optionsFromCMS.items.map(item=>({
280
+ label: item.title,
281
+ value: item.title
282
+ })));
283
+ console.warn("something is wrong with the dropdown options, fixing it");
274
284
  }
275
285
 
276
286