Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
fisherspy authored Aug 7, 2024
2 parents cc08992 + ac46912 commit f9f2a49
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/hooks/src/useRequest/src/useRequestImplement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function useRequestImplement<TData, TParams extends any[]>(
options: Options<TData, TParams> = {},
plugins: Plugin<TData, TParams>[] = [],
) {
const { manual = false, ...rest } = options;
const { manual = false, ready = true, ...rest } = options;

if (isDev) {
if (options.defaultParams && !Array.isArray(options.defaultParams)) {
Expand All @@ -24,6 +24,7 @@ function useRequestImplement<TData, TParams extends any[]>(

const fetchOptions = {
manual,
ready,
...rest,
};

Expand All @@ -46,7 +47,7 @@ function useRequestImplement<TData, TParams extends any[]>(
fetchInstance.pluginImpls = plugins.map((p) => p(fetchInstance, fetchOptions));

useMount(() => {
if (!manual) {
if (!manual && ready) {
// useCachePlugin can set fetchInstance.state.params from cache when init
const params = fetchInstance.state.params || options.defaultParams || [];
// @ts-ignore
Expand Down

0 comments on commit f9f2a49

Please sign in to comment.