@xen-orchestra/web-core 0.48.1 → 0.48.2
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.
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
import type { ResourceContext, UseRemoteResource } from '@core/packages/remote-resource/types.ts'
|
|
8
8
|
import type { VoidFunction } from '@core/types/utility.type.ts'
|
|
9
9
|
import { ifElse } from '@core/utils/if-else.utils.ts'
|
|
10
|
-
import { type MaybeRef, noop, useTimeoutPoll } from '@vueuse/core'
|
|
11
|
-
import {
|
|
10
|
+
import { type MaybeRef, noop, useDebounceFn, useTimeoutPoll } from '@vueuse/core'
|
|
11
|
+
import { merge, remove } from 'lodash-es'
|
|
12
12
|
import readNDJSONStream from 'ndjson-readablestream'
|
|
13
13
|
import {
|
|
14
14
|
computed,
|
|
@@ -259,7 +259,18 @@ export function defineRemoteResource<
|
|
|
259
259
|
|
|
260
260
|
const data = shallowRef(buildData()) as Ref<TData>
|
|
261
261
|
// trigger reactivity on data when no more updates since 100ms or after 500ms
|
|
262
|
-
const flushData =
|
|
262
|
+
const flushData = useDebounceFn(
|
|
263
|
+
() => {
|
|
264
|
+
if (Array.isArray(data.value)) {
|
|
265
|
+
triggerRef(data)
|
|
266
|
+
} else if (data.value != null) {
|
|
267
|
+
// create a new JS reference to ensure vueJS detect the change
|
|
268
|
+
data.value = { ...data.value }
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
100,
|
|
272
|
+
{ maxWait: 500 }
|
|
273
|
+
)
|
|
263
274
|
|
|
264
275
|
async function execute() {
|
|
265
276
|
try {
|