Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFR] Convert GET_MANY accumulate saga to hooks #3550

Merged
merged 15 commits into from
Aug 22, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 5 additions & 1 deletion packages/ra-ui-materialui/src/field/ReferenceField.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ export const ReferenceFieldView = ({
}
if (error) {
return (
<Error aria-errormessage="Error" color="error" fontSize="small" />
<Error
aria-errormessage={error.message ? error.message : error}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't we translate this error ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ideally, yes. In a future PR? I'd like to have this pr merged quickly to release a new alpha soon.

color="error"
fontSize="small"
/>
);
}
if (!referenceRecord) {
Expand Down
4 changes: 2 additions & 2 deletions packages/ra-ui-materialui/src/field/ReferenceField.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ describe('<ReferenceField />', () => {

it('should display an error icon if the dataProvider call fails', async () => {
const dataProvider = jest.fn();
dataProvider.mockImplementationOnce(() => Promise.reject());
dataProvider.mockImplementationOnce(() => Promise.reject('boo'));
const { getByRole } = renderWithRedux(
<DataProviderContext.Provider value={dataProvider}>
<ReferenceField
Expand All @@ -210,7 +210,7 @@ describe('<ReferenceField />', () => {
await new Promise(resolve => setTimeout(resolve, 10));
const ErrorIcon = getByRole('presentation');
expect(ErrorIcon).toBeDefined();
expect(ErrorIcon.getAttribute('aria-errormessage')).toBe('Error');
expect(ErrorIcon.getAttribute('aria-errormessage')).toBe('boo');
});

describe('ReferenceFieldView', () => {
Expand Down