Skip to content

Commit 568d2d0

Browse files
committed
refactor: replace resolveEnabled with resolveOption for consistency
Remove specialized resolveEnabled function and consolidate functionality into the generic resolveOption utility. Both functions performed identical operations but resolveEnabled was type-specific to query enabled state. - Remove resolveEnabled function from utils.ts - Update queryObserver.ts to use resolveOption instead - Remove unused Enabled type import - Maintain identical functionality and type safety
1 parent 24d06b5 commit 568d2d0

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

packages/query-core/src/queryObserver.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ export class QueryObserver<
565565
isStale: isStale(query, options),
566566
refetch: this.refetch,
567567
promise: this.#currentThenable,
568-
isEnabled: resolveEnabled(options.enabled, query) !== false,
568+
isEnabled: resolveOption(options.enabled, query) !== false,
569569
}
570570

571571
const nextResult = result as QueryObserverResult<TData, TError>

packages/query-core/src/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ export function resolveOption<T, TArgs extends Array<any>>(
165165
return isFunctionVariant(value) ? value(...args) : value
166166
}
167167

168+
168169
export function functionalUpdate<TInput, TOutput>(
169170
updater: Updater<TInput, TOutput>,
170171
input: TInput,

0 commit comments

Comments
 (0)