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

Fix prop-types for missingComponentComponent to allow a functional component #459

Merged

Conversation

vsirakova
Copy link
Contributor

@vsirakova vsirakova commented Sep 30, 2020

Description

  • Add a unit test in Placeholder.test.tsx that checks the case when an unknown component is requested for rendering -> then the passed missingComponentComponent prop of the Placeholder should be used.
  • Fix prop-types for missingComponentComponent prop as it currently allows only objects while it should allow a function

Motivation

When a custom MissingComponent implementation is passed to the missingComponentComponent prop there is a runtime error saying Failed prop type: Invalid prop missingComponentComponent supplied to PlaceholderComponent.
This is because the prop-types are incorrect and don't allow a function.

How Has This Been Tested?

I have added a test case that is using the missingComponentComponent prop and when this test is ran with the old prop-types then the runtime error is reproduced.
When prop-types allow for a func the runtime error disappears.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update (non-breaking change; modified files are limited to the /docs directory)

Checklist:

  • I have read the Contributing guide.
  • My code follows the code style of this project.
  • My code/comments/docs fully adhere to the Code of Conduct.
  • My change is a code change and it requires an update to the documentation.
  • My change is a documentation change and it requires an update to the navigation.

Copy link
Contributor

@sc-illiakovalenko sc-illiakovalenko left a comment

Choose a reason for hiding this comment

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

@vsirakova Thank you for contribution!

@sc-illiakovalenko sc-illiakovalenko merged commit d873222 into Sitecore:dev Dec 7, 2020
anastasiya29 added a commit that referenced this pull request Feb 24, 2021
Add PR #538 to bug fixes and restore incorrect removal of PR #459 from breaking changes
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.

None yet

2 participants