4.0.0
Read the announcement blog post
React-admin v4 focuses on modernizing the inner workings of the library. It improves the developper experience a great deal, and paves the way for future changes. It is the result of 6 months of intensive refactoring, development, and test.
The following list concerns version 4.0.0, as well as all the pre-releases (alpha, beta, and rc).
🎉 New features
- Add
<Admin requireAuth>
to hide the app until auth is checked (#7475) - Add
<Admin basename>
to allow mounting react-admin inside a sub path (#7100, #6917) - Add the ability to pass custom params to all
dataProvider
hooks (#7116) - Add support for partial pagination (i.e. no
total
) (#7120) - Add support for
sx
props in allra-ui-materialui
components (#7175) - Add headless
<Form>
component (#7087) - Add
<ReferenceOneField>
(#7060) - Add
<CustomRoutes>
(#7345) - Add
useStore
and persistent preferences (backport fromra-enterprise
) (#7158, #7366) - Add Saved Queries (#7354)
- Add
<ToggleThemeButton>
(#7340) - Add
<LocalesMenuButton>
(#7332) - Add
useSetTheme
(#7008) - Add
combineDataProvider
helper (#7055) - Add
<Datagrid expandSingle>
to limit the number of expanded rows to 1 (#7454) - Add
<ChoicesContextProvider>
in all ReferenceInputs to avoid child cloning and allow choices filtering, pagination, and sorting (#7185) - Add
<FileInput validateFileRemoval>
prop to allow confirmation before file deletion (#7003) - Add ability to register custom
<Resource options>
(#7392)
📦 Dependency Updates
- Add React 18 compatibility (#7377)
- Upgrade
material-ui
to v5 (and it's now calledMUI
) (#6650) - Use
react-query
for data fetching instead of home made solution (#6779, #6916, #7006, #7016, #7025, #6891, #7035, #7020, #7035, #7001) - Replace
react-final-form
withreact-hook-form
(#7087) - Upgrade
react-router
to V6 (#6873) - Replace
Quill
byTipTap
in<RichTextInput>
(#7153) - Upgrade dependencies to their latest major versions
🏹 Updated Syntax
- Change the
Record
TypeScript name toRaRecord
(#7078) - Change data provider hooks signature to reflect the data provider signature
- Remove prop injection and child cloning, use context instead (#7060, #7218, #7215, #7214, #7207, #7206, #7205, #7203).
- Remove
record
prop injection - Remove permissions injection in main route controllers (#6921)
- Avoid cloning Inputs components to pass
variant
andmargin
, and document theme override instead (#7223) - Rename
loading
toisLoading
inauthProvider
hooks return type (#7334) - Rename
initialValues
todefaultValues
in<Form>
(caused by switch toreact-hook-form
) - Move
bulkActionButtons
from<List>
to<Datagrid>
(#7114) - Rename
currentSort
tosort
(#7076) - Change
setSort
signature to make it consistent across components (#7065) - Use MUI autocomplete instead of our own (#6924, #6971)
- Rename
<TranslationProvider>
to<I18nContextProvider>
- Switch
<WithPermissions>
wrapping to auseAuthenticated
hook in main controllers (#6921) - Move
<Notification>
component into<AdminUI>
to avoid gotchas when overriding the layout (#7082)
🧹 Cleanup
- Remove
Redux
(#7177) - Remove
redux-saga
and saga-based side effects (#6684) - Remove
connected-react-router
(#6704) - Remove
basePath
(#7100) - Remove
addLabel
prop in Field components (#7223) - Remove
Resource
initialization, Store Resource definitions in Context rather than in store (#7051) - Remove HOCs (like
addField
) and render props - Remove
useQuery
anduseMutation
(asreact-query
already provides them) (#7001) - Remove application cache and
validUntil
(#7001) - Remove
useVersion
(#7001) - Remove
allowEmpty
prop in choice inputs (#7200) - Remove deprecated
sort
prop in<DataGridHeaderCell>
(#7065) - Remove
<FormWithRedirect>
andhandleSubmitWithRedirect
(#7087) - Remove
TestContext
(<AdminContext>
does the trick) andra-test
(#7148) - Remove declarative side effects support in dataProvider (#6687)
- Remove
useGetMatching
(use getList instead) (#6916) - Remove support for
undoable
prop now that we havemutationMode
(#6711) - Remove
withTranslate
HOC (#7157) - Remove
ra-test
(#7148) - Use
esbuild
instead ofwebpack
for simple example - Use GitHub actions instead of Travis for CI
📚 Updated Documentation
- The v4 documentation was deeply reorganized to allow easier discovery and faster navigation.
- Most of the common hooks and components now have a dedicated documentation page.
- We've added a Storybook to help you discover the components API.
- The demos (e-commerce, CRM) were updated to show how to build application in idiomatic react-admin.
🪜 Upgrade Guide
As this is a major release, there are breaking changes. We documented all the changes required in a react-admin v3 application to make it compatible with version 4 in the react-admin v4 Upgrade Guide.
📊 Statistics
- 1,259 changed files
- 2,210 commits
- 100,420 additions and 90,560 deletions (code and documentation)
Since react-admin counts about 112,000 lines of code, this means that 90% of the codebase was touched.
💌 Thank You
Many thanks to all the contributors (whether they helped developing, testing, documenting, proofreading react-admin v4), and in particular to the core team (fzaninotto, djhi, WiXSL) for their hard work.