Skip to content

Commit b346414

Browse files
authored
Merge pull request #10910 from marmelab/useMutationWithMutationMode
Introduce `useMutationWithMutationMode` hook
2 parents 7df8d6a + 2ff1330 commit b346414

File tree

14 files changed

+1511
-1945
lines changed

14 files changed

+1511
-1945
lines changed

packages/ra-core/src/controller/edit/EditBase.spec.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ describe('EditBase', () => {
8585
resource: 'posts',
8686
meta: undefined,
8787
},
88-
{ snapshot: [] }
88+
{ snapshot: expect.any(Array) }
8989
);
9090
});
9191
});
@@ -129,7 +129,7 @@ describe('EditBase', () => {
129129
resource: 'posts',
130130
meta: undefined,
131131
},
132-
{ snapshot: [] }
132+
{ snapshot: expect.any(Array) }
133133
);
134134
});
135135
expect(onSuccess).not.toHaveBeenCalled();
@@ -166,7 +166,7 @@ describe('EditBase', () => {
166166
resource: 'posts',
167167
meta: undefined,
168168
},
169-
{ snapshot: [] }
169+
{ snapshot: expect.any(Array) }
170170
);
171171
});
172172
});
@@ -203,7 +203,7 @@ describe('EditBase', () => {
203203
resource: 'posts',
204204
meta: undefined,
205205
},
206-
{ snapshot: [] }
206+
{ snapshot: expect.any(Array) }
207207
);
208208
});
209209
expect(onError).not.toHaveBeenCalled();

packages/ra-core/src/dataProvider/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export * from './useDelete';
2626
export * from './useDeleteMany';
2727
export * from './useInfiniteGetList';
2828
export * from './undo/';
29+
export * from './useMutationWithMutationMode';
2930

3031
export type { Options } from './fetch';
3132

packages/ra-core/src/dataProvider/useCreate.spec.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ describe('useCreate', () => {
420420

421421
describe('middlewares', () => {
422422
it('when pessimistic, it accepts middlewares and displays result and success side effects when dataProvider promise resolves', async () => {
423+
jest.spyOn(console, 'error').mockImplementation(() => {});
423424
render(<WithMiddlewaresSuccessPessimistic timeout={10} />);
424425
screen.getByText('Create post').click();
425426
await waitFor(() => {

0 commit comments

Comments
 (0)