Skip to content

Commit 3d5ad28

Browse files
committed
feat: set pending state before debounced requests
In the `makeFindMixin`, if the request is going to be debounced, the `isFind<Items>Pending` attribute is now set before the debounce timeout. This assures that a loading indicator can be shown during the debounce timeout. It makes pagination operate much more smoothly.
1 parent a5cabad commit 3d5ad28

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/make-find-mixin.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,16 @@ export default function makeFindMixin(options) {
241241
}
242242
}
243243
this.$watch(prop, function() {
244+
// If the request is going to be debounced, set IS_FIND_PENDING to true.
245+
// Without this, there's not a way to show a loading indicator during the debounce timeout.
246+
const paramsToUse = getParams({
247+
providedParams: null,
248+
params: this[PARAMS],
249+
fetchParams: this[FETCH_PARAMS]
250+
})
251+
if (paramsToUse.debounce) {
252+
this[IS_FIND_PENDING] = true
253+
}
244254
return this[`${FIND_ACTION}DebouncedProxy`]()
245255
})
246256
})

0 commit comments

Comments
 (0)