Support Relay Classic (#3595)

master
Jimmy Jia 2017-12-28 09:20:25 -08:00 committed by Lucas Duailibe
parent b0647cb2c9
commit bbfc450cd2
3 changed files with 33 additions and 2 deletions

View File

@ -39,8 +39,10 @@ function embed(path, print, textToDoc /*, options */) {
parent &&
((parent.type === "TaggedTemplateExpression" &&
((parent.tag.type === "MemberExpression" &&
parent.tag.object.name === "graphql" &&
parent.tag.property.name === "experimental") ||
((parent.tag.object.name === "graphql" &&
parent.tag.property.name === "experimental") ||
(parent.tag.object.name === "Relay" &&
parent.tag.property.name === "QL"))) ||
(parent.tag.type === "Identifier" &&
(parent.tag.name === "gql" || parent.tag.name === "graphql")))) ||
(parent.type === "CallExpression" &&

View File

@ -394,6 +394,7 @@ gql\`
exports[`react-relay.js 1`] = `
const { graphql } = require("react-relay");
const Relay = require("react-relay/classic");
graphql\`
mutation MarkReadNotificationMutation(
@ -410,8 +411,17 @@ graphql.experimental\`
)
{ markReadNotification(data: $input ) { notification {seenState} } }
\`;
Relay.QL\`
mutation MarkReadNotificationMutation(
$input
: MarkReadNotificationData!
)
{ markReadNotification(data: $input ) { notification {seenState} } }
\`;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
const { graphql } = require("react-relay");
const Relay = require("react-relay/classic");
graphql\`
mutation MarkReadNotificationMutation($input: MarkReadNotificationData!) {
@ -433,4 +443,14 @@ graphql.experimental\`
}
\`;
Relay.QL\`
mutation MarkReadNotificationMutation($input: MarkReadNotificationData!) {
markReadNotification(data: $input) {
notification {
seenState
}
}
}
\`;
`;

View File

@ -1,4 +1,5 @@
const { graphql } = require("react-relay");
const Relay = require("react-relay/classic");
graphql`
mutation MarkReadNotificationMutation(
@ -15,3 +16,11 @@ graphql.experimental`
)
{ markReadNotification(data: $input ) { notification {seenState} } }
`;
Relay.QL`
mutation MarkReadNotificationMutation(
$input
: MarkReadNotificationData!
)
{ markReadNotification(data: $input ) { notification {seenState} } }
`;