sr-npm 1.7.626 → 1.7.627

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.626",
3
+ "version": "1.7.627",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -2,6 +2,7 @@ const { COLLECTIONS,CUSTOM_VALUES_COLLECTION_FIELDS,JOBS_COLLECTION_FIELDS } = r
2
2
  const { items: wixData } = require('@wix/data');
3
3
  const {CAREERS_MULTI_BOXES_PAGE_CONSTS} = require('../backend/careersMultiBoxesPageIds');
4
4
 
5
+ let valuesByFieldIdGlobal = null;
5
6
  const selectedByField = new Map(); // fieldId -> array of selected value IDs
6
7
  const optionsByFieldId = new Map(); // fieldId -> [{label, value}] array of objects with label which is the valueLabel and value which is the valueId
7
8
  const countsByFieldId = new Map(); // fieldId -> {valueId: count} map of counts for each valueId
@@ -251,12 +252,12 @@ async function refreshFacetCounts(_$w) {
251
252
  const selectedItems = [];
252
253
  for (const [fieldId, valueIds] of selectedByField.entries()) {
253
254
  const opts = optionsByFieldId.get(fieldId) || [];
254
- //const byId = new Map(opts.map(o => [o.value, o.label]));
255
+ const byId = new Map(opts.map(o => [o.value, o.label]));
255
256
  for (const id of valueIds) {
256
- const found = opts.find((option) => option.value === id);
257
- const label = found.label;
257
+ const label = byId.get(id);
258
+ if (label) {
258
259
  selectedItems.push({ _id: `${fieldId}:${id}`, label, fieldId, valueId: id });
259
- // selectedItems.push({ label, fieldId, _id: id }); //_id is the valueId
260
+ }
260
261
  }
261
262
  }
262
263
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SELECTED_VALUES_REPEATER).data = selectedItems;