sr-npm 1.7.1079 → 1.7.1086

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.1079",
3
+ "version": "1.7.1086",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -21,6 +21,7 @@ let allsecondarySearchJobs=[] // secondary search results that are displayed in
21
21
  let currentSecondarySearchJobs=[] // current secondary search results that are displayed in the jobs repeater
22
22
  let secondarySearchIsFilled=false // whether the secondary search is filled with results
23
23
  let keywordAllJobs; // all jobs that are displayed in the jobs repeater when the keyword is filled
24
+ let dontActivateURLOnchange=false; // whether to activate the url onchange
24
25
  const pagination = {
25
26
  pageSize: 10,
26
27
  currentPage: 1,
@@ -33,7 +34,7 @@ async function careersMultiBoxesPageOnReady(_$w,urlParams) {
33
34
  });
34
35
 
35
36
  await loadData(_$w);
36
- await loadJobsRepeater(_$w);
37
+ await loadJobsRepeater(_$w); // if we remove the await here the job list will be flaky , it doesn't fill it properly
37
38
  loadPrimarySearchRepeater(_$w);
38
39
  await loadFilters(_$w);
39
40
  loadSelectedValuesRepeater(_$w);
@@ -52,13 +53,15 @@ async function careersMultiBoxesPageOnReady(_$w,urlParams) {
52
53
  }
53
54
 
54
55
  async function handleBackAndForth(_$w){
56
+ console.log("inside handleBackAndForth dontActivateURLOnchange: ",dontActivateURLOnchange);
57
+ if(!dontActivateURLOnchange) {
55
58
  const newQueryParams=await location.query();
56
- console.log("newQueryParams: ", newQueryParams);
57
- await clearAll(_$w,true);
58
- await handleUrlParams(_$w,newQueryParams);
59
+ console.log("newQueryParams: ", newQueryParams);
60
+ await clearAll(_$w,true);
61
+ await handleUrlParams(_$w,newQueryParams);
62
+ }
59
63
  }
60
64
 
61
-
62
65
  async function clearAll(_$w,urlOnChange=false) {
63
66
  if(selectedByField.size>0 || _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SECONDARY_SEARCH_INPUT).value || _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value) {
64
67
  for(const field of allfields) {
@@ -238,6 +241,7 @@ async function handleParams(_$w,param,values) {
238
241
  const field=getFieldById(fieldId,allfields);
239
242
  let fieldTitle=field.title.toLowerCase().replace(' ', '');
240
243
  fieldTitle==="brands"? fieldTitle="brand":fieldTitle;
244
+ dontActivateURLOnchange=true;
241
245
  if (updated.length) {
242
246
  selectedByField.set(fieldId, updated);
243
247
  queryParams.add({ [fieldTitle] : updated.map(val=>encodeURIComponent(val)).join(',') });
@@ -245,6 +249,7 @@ async function handleParams(_$w,param,values) {
245
249
  selectedByField.delete(fieldId);
246
250
  queryParams.remove([fieldTitle ]);
247
251
  }
252
+ dontActivateURLOnchange=false;
248
253
  const currentVals = _$w(`#${FiltersIds[field.title]}CheckBox`).value || [];
249
254
  const nextVals = currentVals.filter(v => v !== valueId);
250
255
  _$w(`#${FiltersIds[field.title]}CheckBox`).value = nextVals;
@@ -344,7 +349,7 @@ async function loadJobsRepeater(_$w) {
344
349
  const selected = ev.target.value; // array of selected value IDs
345
350
  let fieldTitle=field.title.toLowerCase().replace(' ', '');
346
351
  fieldTitle==="brands"? fieldTitle="brand":fieldTitle;
347
-
352
+ dontActivateURLOnchange=true;
348
353
  console.log("selected: ",selected)
349
354
  if (selected && selected.length) {
350
355
  selectedByField.set(field._id, selected);
@@ -356,14 +361,13 @@ async function loadJobsRepeater(_$w) {
356
361
  else{
357
362
  queryParams.add({ [fieldTitle] : selected.map(val=>encodeURIComponent(val)).join(',') });
358
363
  }
359
-
364
+ dontActivateURLOnchange=false;
360
365
  } else {
361
366
  selectedByField.delete(field._id);
362
367
  queryParams.remove([fieldTitle ]);
363
368
  }
364
369
  console.log("selectedByField: ",selectedByField)
365
370
  await updateJobsAndNumbersAndFilters(_$w);
366
-
367
371
  });
368
372
  const runFilter = debounce(() => {
369
373
  const query = (_$w(`#${FiltersIds[field.title]}input`).value || '').toLowerCase().trim();