@steroidsjs/core 2.2.34 → 2.2.35
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 +12 -1
- package/package.json +1 -1
package/hooks/useDataProvider.js
CHANGED
|
@@ -46,6 +46,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
46
46
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
50
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
51
|
+
to[j] = from[i];
|
|
52
|
+
return to;
|
|
53
|
+
};
|
|
49
54
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
55
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
56
|
};
|
|
@@ -54,6 +59,7 @@ var react_redux_1 = require("react-redux");
|
|
|
54
59
|
var isString_1 = __importDefault(require("lodash-es/isString"));
|
|
55
60
|
var isFunction_1 = __importDefault(require("lodash-es/isFunction"));
|
|
56
61
|
var isEqual_1 = __importDefault(require("lodash-es/isEqual"));
|
|
62
|
+
var uniqBy_1 = __importDefault(require("lodash-es/uniqBy"));
|
|
57
63
|
var react_1 = require("react");
|
|
58
64
|
var react_use_1 = require("react-use");
|
|
59
65
|
var fields_1 = require("../actions/fields");
|
|
@@ -132,6 +138,9 @@ function useDataProvider(config) {
|
|
|
132
138
|
if (!config.query) {
|
|
133
139
|
setSourceItems(newItems);
|
|
134
140
|
}
|
|
141
|
+
else {
|
|
142
|
+
setSourceItems(uniqBy_1["default"](__spreadArray(__spreadArray([], sourceItems), newItems), 'id'));
|
|
143
|
+
}
|
|
135
144
|
setItems(newItems);
|
|
136
145
|
return [2 /*return*/];
|
|
137
146
|
}
|
|
@@ -158,7 +167,9 @@ function useDataProvider(config) {
|
|
|
158
167
|
delayTimerRef.current = setTimeout(fetchRemote, autoComplete.delay);
|
|
159
168
|
}
|
|
160
169
|
}
|
|
161
|
-
}, [autoComplete, components.api, components.http, config.autoFetch,
|
|
170
|
+
}, [autoComplete, components.api, components.http, config.autoFetch,
|
|
171
|
+
config.dataProvider, config.initialSelectedIds, config.query, dataProvider,
|
|
172
|
+
dataProvider.action, dataProvider.onSearch, prevParams, prevQuery, prevValues, setSourceItems, sourceItems]);
|
|
162
173
|
return {
|
|
163
174
|
sourceItems: sourceItems,
|
|
164
175
|
items: items,
|