@steroidsjs/core 2.2.23 → 2.2.24
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 +4 -0
- package/package.json +1 -1
package/hooks/useDataProvider.js
CHANGED
|
@@ -92,6 +92,7 @@ function useDataProvider(config) {
|
|
|
92
92
|
var isAutoFetchedRef = react_1.useRef(false);
|
|
93
93
|
var prevQuery = react_use_1.usePrevious(config.query);
|
|
94
94
|
var prevParams = react_use_1.usePrevious(dataProvider.params);
|
|
95
|
+
var prevValues = react_use_1.usePrevious(config.initialSelectedIds);
|
|
95
96
|
react_1.useEffect(function () {
|
|
96
97
|
var fetchRemote = function (isAuto) { return __awaiter(_this, void 0, void 0, function () {
|
|
97
98
|
var searchHandler, result, newItems;
|
|
@@ -125,6 +126,9 @@ function useDataProvider(config) {
|
|
|
125
126
|
// Client-side search on static items
|
|
126
127
|
setItems(config.query ? text_1.smartSearch(config.query, sourceItems) : sourceItems);
|
|
127
128
|
}
|
|
129
|
+
else if (!isEqual_1["default"](prevValues, config.initialSelectedIds)) {
|
|
130
|
+
fetchRemote(true);
|
|
131
|
+
}
|
|
128
132
|
else if (config.autoFetch && isAutoFetchedRef.current === false) {
|
|
129
133
|
isAutoFetchedRef.current = true;
|
|
130
134
|
fetchRemote(true);
|