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

[RFR] Check minimum required props are passed to controllers #2782

Merged
merged 1 commit into from
Jan 17, 2019

Conversation

Kmaschta
Copy link
Contributor

@Kmaschta Kmaschta commented Jan 17, 2019

When we forgot to pass the props from the parent to the controller, the app displays a huge error.

// For example:
const PostShow = () => (
    <Show title={<PostTitle />} />
);

// Instead of:
const PostShow = props => (
    <Show title={<PostTitle />} {...props} />
);

Current Error Message:

image

New Error Message

image

@djhi djhi added this to the 2.6.2 milestone Jan 17, 2019
Copy link
Collaborator

@djhi djhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent! I think we should apply that to many other components (Toolbar, Filter, etc.)
👍

@Kmaschta Kmaschta force-pushed the check-props-are-passed-to-ctrl branch from d2e9f9d to 03c90a5 Compare January 17, 2019 15:57
@Kmaschta
Copy link
Contributor Author

Kmaschta commented Jan 17, 2019

Last minute change: throw Error instead of a console.error(); return null; since the default Layout catch rendering errors. (screenshots updated)

@djhi You're right, that's why I wrote a HOC :)
The error message might change, tho.

@djhi djhi merged commit 980e01a into master Jan 17, 2019
@djhi djhi deleted the check-props-are-passed-to-ctrl branch January 17, 2019 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants