@next-core/brick-kit 2.117.4 → 2.117.5

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.117.5](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.117.4...@next-core/brick-kit@2.117.5) (2022-04-11)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * useProvider hook 支持query查询provider ([c8581e8](https://github.com/easyops-cn/next-core/commit/c8581e877f740f4218ac296eaa6448ce54be2803))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [2.117.4](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.117.3...@next-core/brick-kit@2.117.4) (2022-04-11)
7
18
 
8
19
 
@@ -13625,26 +13625,32 @@
13625
13625
  var response = React.useRef();
13626
13626
  var data = React.useRef(defaults.data);
13627
13627
  var forceUpdate = React.useReducer(() => ({}), [])[1];
13628
- var doFetch = React.useCallback( /*#__PURE__*/_asyncToGenerator__default["default"](function* () {
13629
- try {
13630
- error.current = undefined;
13631
- if (!suspense) setLoading(true);
13628
+ var doFetch = React.useCallback( /*#__PURE__*/function () {
13629
+ var _ref = _asyncToGenerator__default["default"](function* (provider) {
13630
+ try {
13631
+ error.current = undefined;
13632
+ if (!suspense) setLoading(true);
13633
+
13634
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
13635
+ args[_key - 1] = arguments[_key];
13636
+ }
13632
13637
 
13633
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
13634
- args[_key] = arguments[_key];
13638
+ var newRes = yield fetch(provider, ...args);
13639
+ response.current = newRes;
13640
+ data.current = transform(data.current, newRes);
13641
+ } catch (e) {
13642
+ error.current = e;
13635
13643
  }
13636
13644
 
13637
- var newRes = yield fetch(provider, ...args);
13638
- response.current = newRes;
13639
- data.current = transform(data.current, newRes);
13640
- } catch (e) {
13641
- error.current = e;
13642
- }
13645
+ if (!suspense) setLoading(false);
13646
+ if (error.current) onError(error.current);
13647
+ return data.current;
13648
+ });
13643
13649
 
13644
- if (!suspense) setLoading(false);
13645
- if (error.current) onError(error.current);
13646
- return data.current;
13647
- }), [provider, customOptions, dependencies, requestInit, suspense, transform, defaults.data, onError]);
13650
+ return function (_x) {
13651
+ return _ref.apply(this, arguments);
13652
+ };
13653
+ }(), [provider, customOptions, dependencies, requestInit, suspense, transform, defaults.data, onError]);
13648
13654
  var makeFetch = React.useCallback( /*#__PURE__*/function () {
13649
13655
  var _ref2 = _asyncToGenerator__default["default"](function* (providerOrBody, args) {
13650
13656
  var providerStr = provider;
@@ -13664,7 +13670,7 @@
13664
13670
 
13665
13671
  if (suspense) {
13666
13672
  return _asyncToGenerator__default["default"](function* () {
13667
- suspender.current = doFetch(...actualArgs).then(newData => {
13673
+ suspender.current = doFetch(providerStr, ...actualArgs).then(newData => {
13668
13674
  suspenseStatus.current = "success";
13669
13675
  return newData;
13670
13676
  }, error => {
@@ -13677,10 +13683,10 @@
13677
13683
  })();
13678
13684
  }
13679
13685
 
13680
- return doFetch(...actualArgs);
13686
+ return doFetch(providerStr, ...actualArgs);
13681
13687
  });
13682
13688
 
13683
- return function (_x, _x2) {
13689
+ return function (_x2, _x3) {
13684
13690
  return _ref2.apply(this, arguments);
13685
13691
  };
13686
13692
  }(), [doFetch]);