diff --git a/packages/core/useAsyncState/index.ts b/packages/core/useAsyncState/index.ts index e9e7f8d686b7..08b377a22aab 100644 --- a/packages/core/useAsyncState/index.ts +++ b/packages/core/useAsyncState/index.ts @@ -41,6 +41,13 @@ export interface AsyncStateOptions { * @default true */ resetOnExecute?: boolean + + /** + * Use shallowRef. + * + * @default true + */ + shallow?: boolean } /** @@ -62,9 +69,10 @@ export function useAsyncState( delay = 0, onError = noop, resetOnExecute = true, + shallow = true, } = options - const state = shallowRef(initialState) + const state = shallow ? shallowRef(initialState) : ref(initialState) as Ref const isReady = ref(false) const error = ref(undefined)