@steroidsjs/core 2.2.51 → 2.2.52
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/useFile.js +10 -2
- package/package.json +1 -1
package/hooks/useFile.js
CHANGED
|
@@ -54,8 +54,16 @@ function useFile(props) {
|
|
|
54
54
|
}
|
|
55
55
|
react_1.useEffect(function () {
|
|
56
56
|
if (initialFiles) {
|
|
57
|
-
|
|
58
|
-
.filter(function (item) { return !!item.uid; })
|
|
57
|
+
var normalizedInitialFiles_1 = [].concat(initialFiles || [])
|
|
58
|
+
.filter(function (item) { return !!item.uid; });
|
|
59
|
+
// Remove not exists
|
|
60
|
+
var toDelete = uploader.queue.getFiles()
|
|
61
|
+
.filter(function (file) { return !normalizedInitialFiles_1.find(function (item) { return item.uid === file.getUid(); }); });
|
|
62
|
+
if (toDelete.length > 0) {
|
|
63
|
+
uploader.queue.remove(toDelete);
|
|
64
|
+
}
|
|
65
|
+
// Add or update
|
|
66
|
+
uploader.queue.add(normalizedInitialFiles_1
|
|
59
67
|
.map(function (item) {
|
|
60
68
|
var path = item.title || item.label || item.uid || item.id;
|
|
61
69
|
var resultHttpMessage = {
|