@knime/hub-features 1.0.16 → 1.0.17

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @knime/hub-features
2
2
 
3
+ ## 1.0.17
4
+
5
+ ### Patch Changes
6
+
7
+ - 9fa8163: bugfix/improvements in uploads: retry only on server error, reset placeholder skeleton on prepare upload error
8
+ - Updated dependencies [9fa8163]
9
+ - @knime/components@1.11.1
10
+ - @knime/utils@1.1.3
11
+
3
12
  ## 1.0.16
4
13
 
5
14
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knime/hub-features",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "Vue components & composables for shared hub features",
5
5
  "homepage": "https://knime.github.io/webapps-common/",
6
6
  "license": "GPL 3 and Additional Permissions according to Sec. 7 (SEE the file LICENSE)",
@@ -27,9 +27,9 @@
27
27
  "consola": "3.2.3",
28
28
  "ofetch": "^1.4.1",
29
29
  "typescript": "^5.4.5",
30
- "@knime/components": "1.11.0",
30
+ "@knime/components": "1.11.1",
31
31
  "@knime/styles": "1.1.1",
32
- "@knime/utils": "1.1.2"
32
+ "@knime/utils": "1.1.3"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "vue": "3.x"
@@ -11,6 +11,8 @@ const DEFAULT_MAX_UPLOAD_QUEUE_SIZE = 10;
11
11
 
12
12
  const DEFAULT_API_BASE_URL = "/_/api";
13
13
 
14
+ const DEFAULT_RETRY_DELAY_MS = 50;
15
+
14
16
  type UseFileUploadOptions = {
15
17
  /**
16
18
  * Max number of concurrent uploads allowed in the upload queue.
@@ -170,7 +172,7 @@ export const useFileUpload = (options: UseFileUploadOptions = {}) => {
170
172
 
171
173
  onFileUploadComplete: ({ uploadId, filePartIds }) => {
172
174
  promise
173
- .retryPromise(() => completeUpload(uploadId, filePartIds))
175
+ .retryPromise({ fn: () => completeUpload(uploadId, filePartIds) })
174
176
  .then(() => {
175
177
  options.onFileUploadComplete?.(uploadId, filePartIds);
176
178
  })
@@ -207,20 +209,21 @@ export const useFileUpload = (options: UseFileUploadOptions = {}) => {
207
209
  totalFilesBeingPrepared: computed(() => prepareQueueSize.value),
208
210
 
209
211
  start: async (parentId: string, files: File[]) => {
212
+ const enqueableFiles = getEnqueueableFiles(files);
210
213
  try {
211
- const enqueableFiles = getEnqueueableFiles(files);
212
-
213
214
  if (enqueableFiles.length === 0) {
214
215
  return;
215
216
  }
216
217
 
217
218
  prepareQueueSize.value += enqueableFiles.length;
218
219
 
219
- const uploadPayload = await promise.retryPromise(() =>
220
- prepareUpload(parentId, enqueableFiles),
221
- );
222
-
223
- prepareQueueSize.value -= enqueableFiles.length;
220
+ const uploadPayload = await promise.retryPromise({
221
+ fn: () => prepareUpload(parentId, enqueableFiles),
222
+ excludeError: (error: FetchError) =>
223
+ // eslint-disable-next-line no-magic-numbers
224
+ Boolean(error.statusCode && error.statusCode < 500),
225
+ retryDelayMS: DEFAULT_RETRY_DELAY_MS,
226
+ });
224
227
 
225
228
  useUploadManagerResult.start(parentId, uploadPayload);
226
229
  } catch (error) {
@@ -229,6 +232,9 @@ export const useFileUpload = (options: UseFileUploadOptions = {}) => {
229
232
  }
230
233
 
231
234
  throw error;
235
+ } finally {
236
+ // errors can only be thrown in the prepareUpload call, useUploadManagerResult.start does its own error handling
237
+ prepareQueueSize.value -= enqueableFiles.length;
232
238
  }
233
239
  },
234
240