Skip to content

Commit d83669e

Browse files
committed
feat: 🎸 v1.1.1
1 parent 6ffbcea commit d83669e

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export interface RuntimeOptionsConfig {
7474
isCors?: boolean;
7575
timeout?: number;
7676
headers?: Record<string, unknown>;
77-
shouldFetch?: () => boolean;
77+
shouldFetch?: (options: RuntimeDataSourceConfig) => boolean;
7878
[option: string]: unknown;
7979
}
8080
export declare type RuntimeOptions = () => RuntimeOptionsConfig; // 考虑需要动态获取值的情况,这里在运行时会真正的转为一个 function

packages/datasource-engine/src/core/RuntimeDataSourceItem.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class RuntimeDataSourceItem<TParams extends Record<string, unknown> = Record<str
9191

9292
if (this._dataSourceConfig.shouldFetch) {
9393
if (typeof this._dataSourceConfig.shouldFetch === 'function') {
94-
shouldFetch = this._dataSourceConfig.shouldFetch();
94+
shouldFetch = this._dataSourceConfig.shouldFetch(this._options);
9595
} else if (typeof this._dataSourceConfig.shouldFetch === 'boolean') {
9696
shouldFetch = this._dataSourceConfig.shouldFetch;
9797
}

packages/datasource-types/src/data-source-runtime.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface RuntimeDataSourceConfig {
1515
isSync?: boolean;
1616
type?: string;
1717
willFetch?: WillFetch;
18-
shouldFetch?: () => boolean;
18+
shouldFetch?: (options:RuntimeOptionsConfig) => boolean;
1919
requestHandler?: CustomRequestHandler;
2020
dataHandler?: DataHandler;
2121
errorHandler?: ErrorHandler;

0 commit comments

Comments
 (0)