question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CreateController breaks flow of 'redirect' prop

See original GitHub issue

Is 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:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
stixistysoncommented, Aug 20, 2018

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.

0reactions
stixistysoncommented, Aug 20, 2018

Yes, It is working.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found