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

deprecate message in favour of content #66

Merged
merged 5 commits into from
Oct 2, 2019
Merged

deprecate message in favour of content #66

merged 5 commits into from
Oct 2, 2019

Conversation

nicmosc
Copy link
Member

@nicmosc nicmosc commented Oct 2, 2019

No description provided.

@nicmosc nicmosc added enhancement New feature or request help wanted Extra attention is needed labels Oct 2, 2019
@nicmosc nicmosc self-assigned this Oct 2, 2019
/** Content shown when the Popover is visible */
message: PropTypes.node.isRequired,
content: PropTypes.node,
Copy link
Member Author

Choose a reason for hiding this comment

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

@larsbs not sure if to make this required or not. Technically it should be, but then you get the deprecation warning message and the prop type not matching since you might still be using message. Thoughts?

@nicmosc nicmosc requested a review from larsbs October 2, 2019 15:30
@larsbs
Copy link
Contributor

larsbs commented Oct 2, 2019

@nicmosc what's the motivation behind this change in the first place?

@nicmosc
Copy link
Member Author

nicmosc commented Oct 2, 2019

@larsbs at first it made sense to have message as we thought of using tooltip for "just" simple messages. But in the end we ended up using them to show more complex info (as it has been the case in the estate admin feature) and "message" ends up being misleading.

But that's not all. After adding the Popover component, which is by nature going to have more than just text in it, and wanting to unify the api, it made more sense to have that prop called content (or at least that represents something more than a single "message")

@larsbs
Copy link
Contributor

larsbs commented Oct 2, 2019

@nicmosc Ok, have you investigated about what's the standard procedure to deprecate a prop-type that was required?

@nicmosc
Copy link
Member Author

nicmosc commented Oct 2, 2019

@larsbs For now i've only been able to find things about "why are proptypes deprecated" when referring to the facebook package, which is just 👌😑

At Airbnb they have a mutuallyExclusive type ljharb/prop-types-tools#14 (comment) which could be a solution. Let me know what you think. Otherwise for now the only solution is to not make either required, and throw an error if neither is passed, though we could do this through a custom validator.

This is interesting, though it's not part of the issue: facebook/prop-types#156 (comment)

@larsbs
Copy link
Contributor

larsbs commented Oct 2, 2019

@nicmosc then, let's just re-create a mutuallyExclusive type like Airbnb and then, trigger the deprecation error if message is used.

@larsbs
Copy link
Contributor

larsbs commented Oct 2, 2019

@nicmosc idea for syntax:

message: CustomPropType.mutuallyExclusive('content', { deprecated: true }),
content: CustomPropType.mutuallyExclusive('message'),

@nicmosc
Copy link
Member Author

nicmosc commented Oct 2, 2019

@larsbs good one, then shall we also have a custom prop for deprecated only?

deprecatedProp: CustomPropTypes.deprecated(PropTypes.string),

@larsbs
Copy link
Contributor

larsbs commented Oct 2, 2019

@nicmosc sure, we're gonna need it eventually.

@nicmosc nicmosc requested review from larsbs and removed request for larsbs October 2, 2019 17:30
@nicmosc nicmosc merged commit 86e1585 into master Oct 2, 2019
@nicmosc nicmosc deleted the fix/tooltip-api branch October 2, 2019 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants