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

resolving broken deprecation message in docs #165

Merged
merged 2 commits into from
Sep 19, 2016

Conversation

brndnblck
Copy link

Relates to:
#157 (comment)

Correcting usages of field.isDeprecated in docs to look at field.deprecationReason instead restores this functionality.

screen shot 2016-09-15 at 2 09 26 pm

##

CC: @davidcelis @Globegitter

@ghost
Copy link

ghost commented Sep 15, 2016

Thank you for your pull request. As you may know, we require contributors to sign our Contributor License Agreement, and we don't seem to have you on file and listed as active anymore. In order for us to review and merge your code, please email cla@fb.com with your details so we can update your status.

@brndnblck
Copy link
Author

I've signed the CLA previously, but let me know if you need anything else here.

@gjtorikian
Copy link

This doesn't seem like it'll show the deprecation reason though. Without getting too UI :neckbeard:y, is it possible to show that inline somehow?

@@ -496,7 +496,7 @@ class TypeDoc extends React.Component {
{': '}
<TypeLink type={field.type} onClick={onClickType} />
{
field.isDeprecated &&
field.deprecationReason &&
Copy link
Contributor

Choose a reason for hiding this comment

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

is it possible to show that inline somehow?

It'll probably be something like:

{
  field.deprecationReason && [
    <span className="doc-alert-text">{' (DEPRECATED)'}</span>,
    <MarkdownContent
      className="doc-alert-text"
      markdown={field.deprecationReason}
    />
  ]
}

Instead of reusing doc-alert-text, though, it'd be nice to get a grey-ish text for the deprecation reason.

@asiandrummer
Copy link
Contributor

Thanks for the contribution @brandonblack! I'd love to get the deprecation reason as well if that's not too much troubles for you.

@@ -496,7 +496,7 @@ class TypeDoc extends React.Component {
{': '}
<TypeLink type={field.type} onClick={onClickType} />
{
field.isDeprecated &&
field.deprecationReason &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, what's happening here?

It's entirely possible that a field is deprecated but also fails to provide a reason.

The previous code looks more correct, so we may need to look elsewhere for the source of the issue.

Copy link
Author

@brndnblck brndnblck Sep 19, 2016

Choose a reason for hiding this comment

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

@leebyron looks like we're no longer passing in isDeprecated to the DocExplorer at all. This was working, but broke in the last release. Nothing else references isDeprecated so it wasn't noticed. Everywhere else we're simply interacting with the deprecationReason only.

This patch sorts the issue out, but as you noted is probably just fixing a symptom of the actual issue (eg. we're not passing in both of these field values).

How about I modify this to be field.isDeprecated || field.deprecationReason since that's really what we want anyway?

Copy link
Contributor

Choose a reason for hiding this comment

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

I like that solution

Copy link
Contributor

Choose a reason for hiding this comment

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

Did it get removed from the introspection query?

Copy link
Author

@brndnblck brndnblck Sep 19, 2016

Choose a reason for hiding this comment

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

@leebyron Hmm. Yeah, I really don't know -- definitely not removed.

Digging through commits here and in graphql-js I don't see anything that would have caused this to change recently. It may be that this never worked as advertised.

In any case, I think checking the presence of either of these fields is what we want since deprecationReason is an optional field.

I've resolved this in 0aa9163

@leebyron
Copy link
Contributor

Also, this doesn't have to be done in this PR, but I think we should actually filter out fields into two groups, such that all the deprecated fields appear in their own section after the supported fields. We could have this section collapsed by default if we wish.

@leebyron
Copy link
Contributor

Yeah this is ideal. Hyo and I think we've found the reason behind the confusion and breakage

@leebyron leebyron merged commit 8cab2ae into graphql:master Sep 19, 2016
@brndnblck brndnblck deleted the fixing-deprecation-messages branch September 19, 2016 21:55
acao pushed a commit to acao/graphiql that referenced this pull request Jun 1, 2019
…25.2

Update codemirror to the latest version 🚀
acao pushed a commit to acao/graphiql that referenced this pull request Jun 5, 2019
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

4 participants