revojs 0.0.79 → 0.0.80
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/dist/index.js +5 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -438,14 +438,17 @@ async function $fetch(scope, input, options) {
|
|
|
438
438
|
function useAsync(scope, invoke, options) {
|
|
439
439
|
const { tasks } = useRuntime(scope);
|
|
440
440
|
const state = createState();
|
|
441
|
-
const isLoading = createState(
|
|
441
|
+
const isLoading = createState(false);
|
|
442
442
|
const execute = async () => {
|
|
443
|
+
isLoading.value = true;
|
|
443
444
|
try {
|
|
444
|
-
const result = await invoke()
|
|
445
|
+
const result = await invoke();
|
|
445
446
|
if (options?.viewTransition) await startViewTransition(() => state.value = result);
|
|
446
447
|
else state.value = result;
|
|
447
448
|
} catch (error) {
|
|
448
449
|
options?.catch?.(error);
|
|
450
|
+
} finally {
|
|
451
|
+
isLoading.value = false;
|
|
449
452
|
}
|
|
450
453
|
return state.value;
|
|
451
454
|
};
|