@steroidsjs/core 2.2.50 → 2.2.51

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.
Files changed (2) hide show
  1. package/hooks/useFile.js +20 -9
  2. package/package.json +1 -1
package/hooks/useFile.js CHANGED
@@ -56,19 +56,30 @@ function useFile(props) {
56
56
  if (initialFiles) {
57
57
  uploader.queue.add([].concat(initialFiles || [])
58
58
  .filter(function (item) { return !!item.uid; })
59
- .map(function (item) { return new File_1["default"]({
60
- path: item.title || item.label || item.uid || item.id,
61
- status: File_1["default"].STATUS_END,
62
- result: File_1["default"].RESULT_SUCCESS,
63
- resultHttpStatus: 200,
64
- resultHttpMessage: {
59
+ .map(function (item) {
60
+ var path = item.title || item.label || item.uid || item.id;
61
+ var resultHttpMessage = {
65
62
  id: item.id || item.uid,
66
63
  images: item.thumbnailUrl
67
64
  ? [{ url: item.thumbnailUrl }]
68
65
  : null
69
- },
70
- uid: item.uid
71
- }); }));
66
+ };
67
+ var file = uploader.queue.getByUid(item.uid);
68
+ if (file) {
69
+ file.setPath(path);
70
+ file.setResultHttpMessage(resultHttpMessage);
71
+ return false;
72
+ }
73
+ return new File_1["default"]({
74
+ path: path,
75
+ status: File_1["default"].STATUS_END,
76
+ result: File_1["default"].RESULT_SUCCESS,
77
+ resultHttpStatus: 200,
78
+ resultHttpMessage: resultHttpMessage,
79
+ uid: item.uid
80
+ });
81
+ })
82
+ .filter(Boolean));
72
83
  forceUpdate();
73
84
  }
74
85
  // eslint-disable-next-line react-hooks/exhaustive-deps
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steroidsjs/core",
3
- "version": "2.2.50",
3
+ "version": "2.2.51",
4
4
  "description": "",
5
5
  "author": "Vladimir Kozhin <hello@kozhindev.com>",
6
6
  "repository": {