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

SimpleForm redirect attribute entails Warning: Received false for a non-boolean attribute redirect. #8411

Closed
magicxor opened this issue Nov 21, 2022 · 1 comment · Fixed by #8414

Comments

@magicxor
Copy link

What you were expecting:
(According to the documentation)

There is no warning in the browser console when I use the SimpleForm tag with redirect={false}

<SimpleForm redirect={false}>
</SimpleForm>

What happened instead:
There is a warning:

Warning: Received `false` for a non-boolean attribute `redirect`.

Steps to reproduce:

  1. Launch CodeSandbox or clone https://github.com/magicxor/react-admin-repro-received-false-for-redirect-bug

  2. Go to User -> 112 -> Edit (http://localhost:3000/#/user/112)

Related code:
CodeSandbox
https://github.com/magicxor/react-admin-repro-received-false-for-redirect-bug

Environment

  • React-admin version: ^4.5.1
  • Last version that did not exhibit the issue (if applicable):
  • React version: ^18.2.0
  • Browser: Chrome 107.0.5304.107 (Official Build) (64-bit) and Firefox 107.0 (64-bit)
  • Stack trace (in case of a JS error):
Warning: Received `false` for a non-boolean attribute `redirect`.

If you want to write it to the DOM, pass a string instead: redirect="false" or redirect={value.toString()}.

If you used to conditionally omit it with redirect={condition && value}, pass redirect={condition ? value : undefined} instead.
div
./node_modules/@emotion/react/dist/emotion-element-6a883da9.browser.esm.js/withEmotionCache/<@http://localhost:3000/static/js/bundle.js:1124:66
Stack@http://localhost:3000/static/js/bundle.js:24108:87
div
./node_modules/@emotion/react/dist/emotion-element-6a883da9.browser.esm.js/withEmotionCache/<@http://localhost:3000/static/js/bundle.js:1124:66
CardContent@http://localhost:3000/static/js/bundle.js:9166:82
DefaultComponent@http://localhost:3000/static/js/bundle.js:92104:18
form
FormGroupsProvider@http://localhost:3000/static/js/bundle.js:82076:18
FormProvider@http://localhost:3000/static/js/bundle.js:143048:7
LabelPrefixContextProvider@http://localhost:3000/static/js/bundle.js:86407:16
RecordContextProvider@http://localhost:3000/static/js/bundle.js:77419:18
OptionalRecordContextProvider@http://localhost:3000/static/js/bundle.js:77363:15
Form@http://localhost:3000/static/js/bundle.js:81975:18
SimpleForm@http://localhost:3000/static/js/bundle.js:92079:18
div
./node_modules/@emotion/react/dist/emotion-element-6a883da9.browser.esm.js/withEmotionCache/<@http://localhost:3000/static/js/bundle.js:1124:66
Paper@http://localhost:3000/static/js/bundle.js:20960:82
./node_modules/@emotion/react/dist/emotion-element-6a883da9.browser.esm.js/withEmotionCache/<@http://localhost:3000/static/js/bundle.js:1124:66
Card@http://localhost:3000/static/js/bundle.js:9300:82
div
div
./node_modules/@emotion/react/dist/emotion-element-6a883da9.browser.esm.js/withEmotionCache/<@http://localhost:3000/static/js/bundle.js:1124:66
EditView@http://localhost:3000/static/js/bundle.js:90534:17
RecordContextProvider@http://localhost:3000/static/js/bundle.js:77419:18
SaveContextProvider@http://localhost:3000/static/js/bundle.js:77516:18
EditContextProvider@http://localhost:3000/static/js/bundle.js:74911:18
EditBase@http://localhost:3000/static/js/bundle.js:74801:18
Edit@http://localhost:3000/static/js/bundle.js:90334:72
UserEdit
RenderedRoute@http://localhost:3000/static/js/bundle.js:132458:7
Routes@http://localhost:3000/static/js/bundle.js:132879:7
ResourceContextProvider@http://localhost:3000/static/js/bundle.js:78396:18
Resource@http://localhost:3000/static/js/bundle.js:78280:16
RenderedRoute@http://localhost:3000/static/js/bundle.js:132458:7
Routes@http://localhost:3000/static/js/bundle.js:132879:7
ErrorBoundary@http://localhost:3000/static/js/bundle.js:125919:37
div
main
div
div
./node_modules/@emotion/react/dist/emotion-element-6a883da9.browser.esm.js/withEmotionCache/<@http://localhost:3000/static/js/bundle.js:1124:66
Layout@http://localhost:3000/static/js/bundle.js:93416:12
div
RenderedRoute@http://localhost:3000/static/js/bundle.js:132458:7
Routes@http://localhost:3000/static/js/bundle.js:132879:7
CoreAdminRoutes@http://localhost:3000/static/js/bundle.js:78099:77
RenderedRoute@http://localhost:3000/static/js/bundle.js:132458:7
Routes@http://localhost:3000/static/js/bundle.js:132879:7
CoreAdminUI@http://localhost:3000/static/js/bundle.js:78206:12
div
./node_modules/@emotion/react/dist/emotion-element-6a883da9.browser.esm.js/withEmotionCache/<@http://localhost:3000/static/js/bundle.js:1124:66
ScopedCssBaseline@http://localhost:3000/static/js/bundle.js:21876:82
AdminUI@http://localhost:3000/static/js/bundle.js:87812:22
InnerThemeProvider@http://localhost:3000/static/js/bundle.js:30802:70
ThemeProvider@http://localhost:3000/static/js/bundle.js:30516:7
ThemeProvider@http://localhost:3000/static/js/bundle.js:30823:7
ThemeProvider@http://localhost:3000/static/js/bundle.js:94915:18
ResourceDefinitionContextProvider@http://localhost:3000/static/js/bundle.js:78468:12
NotificationContextProvider@http://localhost:3000/static/js/bundle.js:84812:18
I18nContextProvider@http://localhost:3000/static/js/bundle.js:83835:12
Router@http://localhost:3000/static/js/bundle.js:132821:7
HistoryRouter@http://localhost:3000/static/js/bundle.js:85371:18
InternalRouter@http://localhost:3000/static/js/bundle.js:85285:18
BasenameContextProvider@http://localhost:3000/static/js/bundle.js:85340:18
AdminRouter@http://localhost:3000/static/js/bundle.js:85267:17
QueryClientProvider@http://localhost:3000/static/js/bundle.js:129625:16
PreferencesEditorContextProvider@http://localhost:3000/static/js/bundle.js:85020:18
StoreContextProvider@http://localhost:3000/static/js/bundle.js:85711:15
CoreAdminContext@http://localhost:3000/static/js/bundle.js:78029:22
AdminContext@http://localhost:3000/static/js/bundle.js:87755:12
Admin@http://localhost:3000/static/js/bundle.js:99936:22
App react-dom.development.js:86
@WiXSL
Copy link
Contributor

WiXSL commented Nov 21, 2022

The redirect prop in SimpleForm component has been removed in version 4.
You are responsible for custom redirection after saving process.
https://marmelab.com/react-admin/Upgrade.html#the-redirect-prop-has-been-removed-from-form-components

It is true that the component propTypes still show this prop.
We have to fix that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants