Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions packages/ra-core/src/dataProvider/useCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,10 @@ export type UseCreateOptions<
RecordType extends Omit<RaRecord, 'id'> = any,
MutationError = unknown,
ResultRecordType extends RaRecord = RecordType & { id: Identifier },
> = Omit<
UseMutationOptions<
ResultRecordType,
MutationError,
Partial<UseCreateMutateParams<RecordType>>
>,
'mutationFn'
> = UseMutationOptions<
ResultRecordType,
MutationError,
Partial<UseCreateMutateParams<RecordType>>
Comment on lines +261 to +264
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allowing mutationFn in the options type creates an inconsistent API. The type now accepts mutationFn, but the runtime implementation (line 116) will silently override any user-provided value since it's defined after ...mutationOptions is spread (line 113). This mismatch between the type system and runtime behavior could confuse API consumers. Consider either: (1) keeping the Omit<..., 'mutationFn'> to prevent users from passing it, or (2) restructuring the code to respect a user-provided mutationFn if that's the intended behavior.

Suggested change
> = UseMutationOptions<
ResultRecordType,
MutationError,
Partial<UseCreateMutateParams<RecordType>>
> = Omit<
UseMutationOptions<
ResultRecordType,
MutationError,
Partial<UseCreateMutateParams<RecordType>>
>,
'mutationFn'

Copilot uses AI. Check for mistakes.
> & {
mutationMode?: MutationMode;
returnPromise?: boolean;
Expand Down
11 changes: 4 additions & 7 deletions packages/ra-core/src/dataProvider/useDelete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,10 @@ export interface UseDeleteMutateParams<RecordType extends RaRecord = any> {
export type UseDeleteOptions<
RecordType extends RaRecord = any,
MutationError = unknown,
> = Omit<
UseMutationOptions<
RecordType,
MutationError,
Partial<UseDeleteMutateParams<RecordType>>
>,
'mutationFn'
> = UseMutationOptions<
RecordType,
MutationError,
Partial<UseDeleteMutateParams<RecordType>>
Comment on lines +275 to +278
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allowing mutationFn in the options type creates an inconsistent API. The type now accepts mutationFn, but the runtime implementation will silently override any user-provided value since it's defined after ...mutationOptions is spread. This mismatch between the type system and runtime behavior could confuse API consumers. Consider either: (1) keeping the Omit<..., 'mutationFn'> to prevent users from passing it, or (2) restructuring the code to respect a user-provided mutationFn if that's the intended behavior.

Suggested change
> = UseMutationOptions<
RecordType,
MutationError,
Partial<UseDeleteMutateParams<RecordType>>
> = Omit<
UseMutationOptions<
RecordType,
MutationError,
Partial<UseDeleteMutateParams<RecordType>>
>,
'mutationFn'

Copilot uses AI. Check for mistakes.
> & {
mutationMode?: MutationMode;
returnPromise?: boolean;
Expand Down
11 changes: 4 additions & 7 deletions packages/ra-core/src/dataProvider/useDeleteMany.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,10 @@ export type UseDeleteManyOptions<
RecordType extends RaRecord = any,
MutationError = unknown,
TReturnPromise extends boolean = boolean,
> = Omit<
UseMutationOptions<
Array<RecordType['id']> | undefined,
MutationError,
Partial<UseDeleteManyMutateParams<RecordType>>
>,
'mutationFn'
> = UseMutationOptions<
Array<RecordType['id']> | undefined,
MutationError,
Partial<UseDeleteManyMutateParams<RecordType>>
Comment on lines +301 to +304
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allowing mutationFn in the options type creates an inconsistent API. The type now accepts mutationFn, but the runtime implementation will silently override any user-provided value since it's defined after ...mutationOptions is spread. This mismatch between the type system and runtime behavior could confuse API consumers. Consider either: (1) keeping the Omit<..., 'mutationFn'> to prevent users from passing it, or (2) restructuring the code to respect a user-provided mutationFn if that's the intended behavior.

Suggested change
> = UseMutationOptions<
Array<RecordType['id']> | undefined,
MutationError,
Partial<UseDeleteManyMutateParams<RecordType>>
> = Omit<
UseMutationOptions<
Array<RecordType['id']> | undefined,
MutationError,
Partial<UseDeleteManyMutateParams<RecordType>>
>,
'mutationFn'

Copilot uses AI. Check for mistakes.
> & { mutationMode?: MutationMode; returnPromise?: TReturnPromise };

export type UseDeleteManyResult<
Expand Down
11 changes: 4 additions & 7 deletions packages/ra-core/src/dataProvider/useUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,13 +305,10 @@ export interface UseUpdateMutateParams<RecordType extends RaRecord = any> {
export type UseUpdateOptions<
RecordType extends RaRecord = any,
ErrorType = Error,
> = Omit<
UseMutationOptions<
RecordType,
ErrorType,
Partial<UseUpdateMutateParams<RecordType>>
>,
'mutationFn'
> = UseMutationOptions<
RecordType,
ErrorType,
Partial<UseUpdateMutateParams<RecordType>>
Comment on lines +308 to +311
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allowing mutationFn in the options type creates an inconsistent API. The type now accepts mutationFn, but the runtime implementation (line 113) will silently override any user-provided value since it's defined after ...mutationOptions is spread (line 110). This mismatch between the type system and runtime behavior could confuse API consumers. Consider either: (1) keeping the Omit<..., 'mutationFn'> to prevent users from passing it, or (2) restructuring the code to respect a user-provided mutationFn if that's the intended behavior.

Suggested change
> = UseMutationOptions<
RecordType,
ErrorType,
Partial<UseUpdateMutateParams<RecordType>>
> = Omit<
UseMutationOptions<
RecordType,
ErrorType,
Partial<UseUpdateMutateParams<RecordType>>
>,
'mutationFn'

Copilot uses AI. Check for mistakes.
> & {
mutationMode?: MutationMode;
returnPromise?: boolean;
Expand Down
11 changes: 4 additions & 7 deletions packages/ra-core/src/dataProvider/useUpdateMany.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,13 +287,10 @@ export interface UseUpdateManyMutateParams<RecordType extends RaRecord = any> {
export type UseUpdateManyOptions<
RecordType extends RaRecord = any,
MutationError = unknown,
> = Omit<
UseMutationOptions<
Array<RecordType['id']>,
MutationError,
Partial<UseUpdateManyMutateParams<RecordType>>
>,
'mutationFn'
> = UseMutationOptions<
Array<RecordType['id']>,
MutationError,
Partial<UseUpdateManyMutateParams<RecordType>>
Comment on lines +290 to +293
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allowing mutationFn in the options type creates an inconsistent API. The type now accepts mutationFn, but the runtime implementation (line 109) will silently override any user-provided value since it's defined after ...mutationOptions is spread (line 106). This mismatch between the type system and runtime behavior could confuse API consumers. Consider either: (1) keeping the Omit<..., 'mutationFn'> to prevent users from passing it, or (2) restructuring the code to respect a user-provided mutationFn if that's the intended behavior.

Suggested change
> = UseMutationOptions<
Array<RecordType['id']>,
MutationError,
Partial<UseUpdateManyMutateParams<RecordType>>
> = Omit<
UseMutationOptions<
Array<RecordType['id']>,
MutationError,
Partial<UseUpdateManyMutateParams<RecordType>>
>,
'mutationFn'

Copilot uses AI. Check for mistakes.
> & {
mutationMode?: MutationMode;
returnPromise?: boolean;
Expand Down
Loading