@cdek-it/widget 3.9.0 → 3.9.1

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/README.md CHANGED
@@ -4,7 +4,6 @@
4
4
  [![jsDelivr hits (GitHub)](https://img.shields.io/jsdelivr/gh/hy/cdek-it/widget)](https://www.jsdelivr.com/package/gh/cdek-it/widget)
5
5
  [![GitHub release (with filter)](https://img.shields.io/github/v/release/cdek-it/widget)](https://github.com/cdek-it/widget/releases)
6
6
 
7
+ [Документация по виджету](https://github.com/cdek-it/widget/blob/main/docs/ru/INTRO.md)
7
8
 
8
- [Документация по виджету](docs/ru/INTRO.md)
9
-
10
- [English version of documentation](docs/en/INTRO.md)
9
+ [English version of documentation](https://github.com/cdek-it/widget/blob/main/docs/en/INTRO.md)
@@ -18365,9 +18365,12 @@ class Widget {
18365
18365
  coreStorage.togglePopup(Popup.INFO);
18366
18366
  }
18367
18367
  }).finally(coreStorage.unlockUi);
18368
- const debouncedUpdate = debounce(async (input) => {
18368
+ const debouncedUpdate = debounce(async (input, forceUpdate = false) => {
18369
18369
  try {
18370
- mapStorage.offices = await this.cdekApi.getOffices();
18370
+ if (forceUpdate) {
18371
+ mapStorage.offices = [];
18372
+ mapStorage.offices = await this.cdekApi.getOffices();
18373
+ }
18371
18374
  searchStorage.searchResults = (await this.yandexApi.geocodeString(input)).members;
18372
18375
  searchStorage.loading = false;
18373
18376
  } catch (e) {
@@ -18379,10 +18382,14 @@ class Widget {
18379
18382
  if (mutation.storeId !== "search" || mutation.type !== "patch object") {
18380
18383
  return;
18381
18384
  }
18385
+ let forceUpdate = false;
18386
+ if (mutation.payload.hasOwnProperty("filters")) {
18387
+ forceUpdate = true;
18388
+ }
18382
18389
  searchStorage.loading = true;
18383
18390
  this.cdekApi.cancelOfficeRequest();
18384
18391
  this.yandexApi.cancelGeocodeStringRequest();
18385
- await debouncedUpdate(state.value);
18392
+ await debouncedUpdate(state.value, forceUpdate);
18386
18393
  });
18387
18394
  const debouncedSearch = debounce(async (coordinates) => {
18388
18395
  try {