Skip to content

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

Merged
djhi merged 1 commit into
masterfrom
check-props-are-passed-to-ctrl
Jan 17, 2019
Merged

djhi merged 1 commit into
masterfrom
check-props-are-passed-to-ctrl

Conversation

@Kmaschta

@Kmaschta Kmaschta commented Jan 17, 2019 •

Copy link
Copy Markdown
Contributor

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

@djhi djhi left a comment

Copy link
Copy Markdown
Contributor

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

Kmaschta commented Jan 17, 2019 •

Copy link
Copy Markdown
Contributor Author

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