kui-utils 0.0.29 → 0.0.31

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/index.js CHANGED
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { useState, useMemo, useEffect } from 'react';
3
3
  import _ from 'lodash';
4
4
  import { useLocation } from 'react-router-dom';
5
- import { isObservable, toJS, makeAutoObservable } from 'mobx';
5
+ import { isObservable, toJS, runInAction, makeAutoObservable } from 'mobx';
6
6
  import { DateTime } from 'luxon';
7
7
 
8
8
  function setRef(ref, value) {
@@ -61,12 +61,13 @@ var useTabIndex = function (paths) {
61
61
 
62
62
  var useWindowWidth = function (time) {
63
63
  if (time === void 0) { time = 10; }
64
- var _a = useState(typeof window === "undefined" ? 0 : (window === null || window === void 0 ? void 0 : window.innerWidth) || 0), width = _a[0], setWidth = _a[1];
64
+ var _a = useState(0), width = _a[0], setWidth = _a[1];
65
65
  useEffect(function () {
66
66
  setWidth(window.innerWidth);
67
67
  var handleResize = _.debounce(function () {
68
68
  setWidth(window.innerWidth);
69
69
  }, time);
70
+ handleResize();
70
71
  window.addEventListener("resize", handleResize);
71
72
  return function () { return window.removeEventListener("resize", handleResize); };
72
73
  }, []);
@@ -2195,7 +2196,9 @@ var Loader = /** @class */ (function () {
2195
2196
  return new Promise(function (resolve) {
2196
2197
  // eslint-disable-next-line no-promise-executor-return
2197
2198
  return setTimeout(function () {
2198
- _this.isLoading = false;
2199
+ runInAction(function () {
2200
+ _this.isLoading = false;
2201
+ });
2199
2202
  resolve(true);
2200
2203
  }, _this.delayTime - (_this.timeAfterLoading - _this.timeBeforeLoading));
2201
2204
  });