CreateController breaks flow of 'redirect' prop
See original GitHub issueIs your feature request related to a problem? Please describe. When you pass a redirect prop from RA-UI-MaterialUI/detail/Create, it dies in the RA-Core/CreateController and is set based on an internal function.
Describe the solution you’d like Only set default if you haven’t passed the prop.
Describe alternatives you’ve considered Even better! - Solution!
replace CreateController.defaultRedirectRoute to:
defaultRedirectRoute() {
if (this.props.redirect) return this.props.redirect;
const { hasShow, hasEdit } = this.props;
if (hasEdit) return 'edit';
if (hasShow) return 'show';
return 'list';
}
or
defaultRedirectRoute() {
const { hasShow, hasEdit, redirect } = this.props;
if (redirect) return redirect;
if (hasEdit) return 'edit';
if (hasShow) return 'show';
return 'list';
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
ReactJS - Pass props with Redirect component - Stack Overflow
Hi... I am having a bit trouble receiving the state param passed with redirect. this.props.location gives me undefined. Any suggestions? – Dhruv ...
Read more >8 The Web Layer 5.2.5 - The Grails Framework
When resolving a URL mapping (forward or reverse) to a namespaced controller, a mapping will only match if the namespace has been provided....
Read more >7 The Web Layer 2.3.1 - GitHub Pages
7.5.4Flow Scopes ... Controllers can be created with the create-controller or ... To enable one of the scopes, add a static scope property...
Read more >W-ClearPass 6.3 Guest Deployment Guide - Dell
These accounts share the same role, expiration and other properties. This requires a vendor passing a mac parameter in the redirect URL.
Read more >Redirections in HTTP - MDN Web Docs - Mozilla
URL redirection, also known as URL forwarding, is a technique to give more than one URL address to a page, a form, or...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ok, so with the information you have listed, I am seeing another way to get this to work without recreating the files in react-admin’s library.
I am using react-admin through api-platform/admin and after previously passing desired props though the same method to their ‘List’ form, I was frustrated that the create form broke the passing of the ‘redirect’ prop. Being their create form does show the children, I will try this solution. If it works, I am satisfied.
Apparently my issue was placing the prop in the element that uses the value, instead of where it is generated from.
Yes, It is working.