Closed Dreamsorcerer closed 1 year ago
Thanks for reporting this. Please provide a sample application showing the issue by forking the following CodeSandbox (https://codesandbox.io/s/github/marmelab/react-admin/tree/master/examples/simple).
It just says 'Initializing Sandbox Container' forever while consuming all the CPU...
Not sure how easy it is for you to run Python, but this is the actual code: https://github.com/aio-libs/aiohttp-admin/blob/redirect/admin-js/src/App.js#L228-L234
It should be possible to run with something like:
git clone https://github.com/aio-libs/aiohttp-admin.git
git checkout redirect
cd aiohttp-admin/
pip3 install -r requirements.txt # Or maybe pip (without the 3)
cd admin-js/
yarn install
yarn build
cd ../examples/
PYTHONPATH='..' python3 simple.py # Or maybe python (without the 3).
Then go to http://localhost:8080/admin (login and password is 'admin') Then just click create, enter a random number and value and click save. It fails to redirect.
@Dreamsorcerer same as https://github.com/marmelab/react-admin/issues/8817#issuecomment-1504887822
If codesandbox is too resource intensive for your computer, please try stackblitz instead which is better optimized.
Have added this to the same demo: https://stackblitz.com/edit/github-9jgv9m-rdxcen?file=src/index.tsx index.tsx
As above, click create (for some reason, it's only visible on wider screens), then enter a random num and value, click save and obverse that no redirect happens.
I'm sorry but I can't accept this sandbox, for the reasons explained here: https://github.com/marmelab/react-admin/issues/8817#issuecomment-1511064628
Please provide another one based on the simple example and tweaking only the minimum code to reproduce the issue.
While working on another issue, I had the opportunity to check this issue as well, and could indeed reproduce the bug. Thanks for the report.
Thanks, working perfectly now.
What you were expecting: redirect to work when warnWhenUnsavedChanges is set.
Both seem to work individually. If no redirect is specified, then Create will correctly redirect to the Edit view. If warnWhenUnsavedChanges is not given, then Create will redirect to the view specified by the redirect attribute. But, when both are used, the redirect is broken and does not redirect at all.
What happened instead: No redirect happened. It just gives a notification that the element was created, but the form doesn't change.
Steps to reproduce: Set
redirect="show"
in the Create element andwarnWhenUnsavedChanges
in the SimpleForm.Related code:
Other information: Documentation suggests a couple of other props can't be used with the redirect, but nothing I saw seemed to suggest it couldn't be used with warnWhenUnsavedChanges.
Environment