@steroidsjs/core 2.2.69 → 2.2.70
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/hooks/useDataProvider.js +6 -5
- package/package.json +1 -1
package/hooks/useDataProvider.js
CHANGED
|
@@ -117,21 +117,22 @@ function useDataProvider(config) {
|
|
|
117
117
|
react_1.useEffect(function () {
|
|
118
118
|
var fetchRemote = function (isAuto) { return __awaiter(_this, void 0, void 0, function () {
|
|
119
119
|
var searchHandler, result, newItems;
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
var _a;
|
|
121
|
+
return __generator(this, function (_b) {
|
|
122
|
+
switch (_b.label) {
|
|
122
123
|
case 0:
|
|
123
124
|
searchHandler = dataProvider.onSearch || (typeof dataProvider.action === 'function'
|
|
124
125
|
? function (method, params) { return method(components.api, params).then(function (response) { return response.data; }); }
|
|
125
126
|
: function (method, params) { return components.http.send(dataProvider.actionMethod, method, params)
|
|
126
127
|
.then(function (response) { return response.data; }); });
|
|
127
|
-
result = searchHandler(dataProvider.action, __assign(__assign({ query: config.query }, (isAuto ? { ids: config.initialSelectedIds } : null)), config.dataProvider.params));
|
|
128
|
+
result = searchHandler(dataProvider.action, __assign(__assign(__assign({ query: config.query }, (isAuto ? { ids: config.initialSelectedIds } : null)), (((_a = config.initialSelectedIds) === null || _a === void 0 ? void 0 : _a.length) > 0 ? { withIds: config.initialSelectedIds } : null)), config.dataProvider.params));
|
|
128
129
|
if (!(result && isFunction_1["default"](result.then))) return [3 /*break*/, 2];
|
|
129
130
|
setIsLoading(true);
|
|
130
131
|
return [4 /*yield*/, result];
|
|
131
132
|
case 1:
|
|
132
|
-
newItems =
|
|
133
|
+
newItems = _b.sent();
|
|
133
134
|
setIsLoading(false);
|
|
134
|
-
|
|
135
|
+
_b.label = 2;
|
|
135
136
|
case 2:
|
|
136
137
|
// Update items
|
|
137
138
|
newItems = data_1.normalizeItems(newItems);
|