Skip to content

Commit

Permalink
Revert Relax material ui version dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
fzaninotto authored and ghodsizadeh committed May 21, 2019
1 parent 4c0a020 commit ce8878b
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 88 deletions.
11 changes: 11 additions & 0 deletions docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ title: "FAQ"
- [How can I customize the UI depending on the user permissions?](#how-can-i-customize-the-ui-depending-on-the-user-permissions)
- [How can I customize forms depending on its inputs values?](#how-can-i-customize-forms-depending-on-its-inputs-values)
- [My Resource is defined but not displayed on the Menu](#my-resource-is-defined-but-not-displayed-on-the-menu)
- [Why React Admin Doesn't Support The Latest Version Of Material-UI?](#why-react-admin-doesnt-support-the-latest-version-of-material-ui)

## Can I have custom identifiers/primary keys for my resources?

Expand Down Expand Up @@ -132,3 +133,13 @@ In order to have a specific resource without `list` prop listed on the menu, you
</div>
);
```

## Why Doesn't React Admin Support The Latest Version Of Material-UI?

React Admin users and third-party libraries maintainers might have noticed that the default UI template `ra-ui-materialui` [has `@material-ui/core@^1.4.0` as dependency](https://github.com/marmelab/react-admin/blob/ae45a2509b391a6ea81cdf9c248ff9d28364b6e1/packages/ra-ui-materialui/package.json#L44) even though the latest version of Material UI is already 3.x.

We chose not to upgrade to Material UI v3 when it was released because the MUI team was already hard at work preparing the next major version ([which includes major breaking changes](https://github.com/mui-org/material-ui/issues/13663)). In fact, material-ui published a release schedule for one major version every 6 months. This means that developers using material-ui have to upgrade their codebase every six months to get the latest updates. On the other hand, react-admin plans to release a major version once every year, minimizing the upgrade work for developers. This gain in stability is a tradeoff - react-admin users can't use the latest version of material-ui for about half a year.

Feel free to discuss this policy in [issue #2399](https://github.com/marmelab/react-admin/issues/2399).

If you are a maintainer of a third-party library based on React Admin, your library has to add material-ui v1.x as a peer dependency.
4 changes: 2 additions & 2 deletions examples/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "~3.9.3",
"@material-ui/icons": "~3.0.2",
"@material-ui/core": "~1.5.1",
"@material-ui/icons": "~1.1.1",
"data-generator-retail": "^2.7.0",
"fakerest": "~2.1.0",
"fetch-mock": "~6.3.0",
Expand Down
4 changes: 2 additions & 2 deletions examples/simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"webpack-dev-server": "~3.1.11"
},
"dependencies": {
"@material-ui/core": "~3.9.3",
"@material-ui/icons": "~3.0.2",
"@material-ui/core": "~1.5.1",
"@material-ui/icons": "~1.1.1",
"@babel/polyfill": "^7.0.0",
"ra-data-fakerest": "^2.0.0",
"ra-input-rich-text": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "~3.9.3",
"@material-ui/core": "~1.5.1",
"ra-data-json-server": "^2.0.0",
"react": "~16.3.1",
"react-admin": "^2.0.0",
Expand Down
8 changes: 4 additions & 4 deletions packages/ra-ui-materialui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"watch": "rimraf ./lib && tsc --watch"
},
"devDependencies": {
"@material-ui/core": "~3.9.3",
"@material-ui/icons": "~3.0.2",
"@material-ui/core": "~1.5.1",
"@material-ui/icons": "~1.1.1",
"cross-env": "^5.2.0",
"enzyme": "~3.7.0",
"enzyme-adapter-react-16": "~1.6.0",
Expand All @@ -43,8 +43,8 @@
"react-dom": "^16.3.0"
},
"dependencies": {
"@material-ui/core": "^1.4.0 || ^3.0.0",
"@material-ui/icons": "^1.0.0 || ^3.0.0",
"@material-ui/core": "^1.4.0",
"@material-ui/icons": "^1.0.0",
"autosuggest-highlight": "^3.1.1",
"classnames": "~2.2.5",
"inflection": "~1.12.0",
Expand Down
12 changes: 8 additions & 4 deletions packages/ra-ui-materialui/src/field/BooleanField.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ import { render, cleanup } from 'react-testing-library';
describe('<BooleanField />', () => {
afterEach(cleanup);
it('should display tick and truthy text if value is true', () => {
const { queryByText, getByRole } = render(
const { queryByText } = render(
<BooleanField
record={{ published: true }}
source="published"
resource="posts"
/>
);
expect(queryByText('ra.boolean.true')).not.toBeNull();
expect(getByRole('presentation').dataset.testid).toBe('true');
expect(queryByText('ra.boolean.true').nextSibling.dataset.testid).toBe(
'true'
);
expect(queryByText('ra.boolean.false')).toBeNull();
});

Expand All @@ -32,16 +34,18 @@ describe('<BooleanField />', () => {
});

it('should display cross and falsy text if value is false', () => {
const { queryByText, getByRole } = render(
const { queryByText } = render(
<BooleanField
record={{ published: false }}
source="published"
resource="posts"
/>
);
expect(queryByText('ra.boolean.true')).toBeNull();
expect(getByRole('presentation').dataset.testid).toBe('false');
expect(queryByText('ra.boolean.false')).not.toBeNull();
expect(queryByText('ra.boolean.false').nextSibling.dataset.testid).toBe(
'false'
);
});

it('should use valueLabelFalse for custom falsy text', () => {
Expand Down
Loading

0 comments on commit ce8878b

Please sign in to comment.