Skip to content

Commit 33beb59

Browse files
committed
fix: resolve GetDataOptions lint warning
1 parent f30fa8a commit 33beb59

3 files changed

Lines changed: 6 additions & 11 deletions

File tree

packages/ra-core/src/controller/list/useInfiniteListController.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,7 @@ export const useInfiniteListController = <
204204
);
205205

206206
const getData = useEvent(
207-
async ({
208-
maxResults,
209-
meta: metaOverride,
210-
}: GetDataOptions<RecordType> = {}) => {
207+
async ({ maxResults, meta: metaOverride }: GetDataOptions = {}) => {
211208
if (total === 0) {
212209
return [];
213210
}

packages/ra-core/src/controller/list/useList.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ export const useList = <RecordType extends RaRecord = any, ErrorType = Error>(
256256
}, [data, selectionModifiers]);
257257

258258
const getData = useCallback(
259-
async ({ maxResults }: GetDataOptions<RecordType> = {}) => {
259+
async ({ maxResults }: GetDataOptions = {}) => {
260260
if (isPending || !data) {
261261
return [];
262262
}

packages/ra-core/src/controller/list/useListController.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,7 @@ export const useListController = <
207207
});
208208

209209
const getData = useEvent(
210-
async ({
211-
maxResults,
212-
meta: metaOverride,
213-
}: GetDataOptions<RecordType> = {}) => {
210+
async ({ maxResults, meta: metaOverride }: GetDataOptions = {}) => {
214211
if (total === 0) {
215212
return [];
216213
}
@@ -537,7 +534,7 @@ export const sanitizeListRestProps = props =>
537534
.filter(propName => !injectedProps.includes(propName))
538535
.reduce((acc, key) => ({ ...acc, [key]: props[key] }), {});
539536

540-
export interface GetDataOptions<RecordType extends RaRecord = any> {
537+
export interface GetDataOptions {
541538
maxResults?: number;
542539
meta?: any;
543540
}
@@ -547,7 +544,8 @@ export interface ListControllerBaseResult<RecordType extends RaRecord = any> {
547544
defaultTitle?: string;
548545
displayedFilters: any;
549546
exporter?: Exporter | false;
550-
getData?: (options?: GetDataOptions<RecordType>) => Promise<RecordType[]>;
547+
// FIXME: make non-optional in next major
548+
getData?: (options?: GetDataOptions) => Promise<RecordType[]>;
551549
filter?: FilterPayload;
552550
filterValues: any;
553551
hideFilter: (filterName: string) => void;

0 commit comments

Comments
 (0)