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

Upgrade to relay v7 #3017

Merged
merged 2 commits into from
Nov 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@
"@types/react": "16.8.7",
"@types/react-dom": "16.8.4",
"@types/react-overlays": "0.8.4",
"@types/react-relay": "6.0.2",
"@types/react-relay": "7.0.2",
"@types/react-slick": "0.23.2",
"@types/react-stripe-elements": "1.1.7",
"@types/react-test-renderer": "16.0.1",
"@types/react-tracking": "7.0.0",
"@types/react-transition-group": "2.0.11",
"@types/relay-compiler": "6.0.1",
"@types/relay-compiler": "7.0.2",
"@types/relay-config": "6.0.0",
"@types/relay-runtime": "6.0.9",
"@types/relay-runtime": "6.0.11",
"@types/storybook__react": "4.0.1",
"@types/styled-components": "4.0.3",
"@types/styled-system": "3.0.9",
Expand All @@ -107,7 +107,7 @@
"babel-plugin-dynamic-import-node": "1.2.0",
"babel-plugin-lodash": "3.3.3",
"babel-plugin-module-resolver": "3.1.1",
"babel-plugin-relay": "6.0.0",
"babel-plugin-relay": "7.1.0",
"babel-plugin-styled-components": "1.10.0",
"babel-plugin-transform-decorators-legacy": "1.3.5",
"cache-loader": "1.2.2",
Expand Down Expand Up @@ -145,9 +145,9 @@
"react-powerplug": "1.0.0",
"react-select": "1.2.1",
"react-test-renderer": "16.8.2",
"relay-compiler": "6.0.0",
"relay-compiler-language-typescript": "9.0.1",
"relay-config": "6.0.0",
"relay-compiler": "7.1.0",
"relay-compiler-language-typescript": "10.1.0",
"relay-config": "7.1.0",
"simple-progress-webpack-plugin": "1.1.2",
"static-extend": "0.1.2",
"styled-components": "4.3.2",
Expand All @@ -163,7 +163,7 @@
"tslint-react": "2.6.0",
"typescript": "3.6.3",
"typescript-styled-plugin": "0.13.0",
"vscode-apollo-relay": "1.4.3",
"vscode-apollo-relay": "1.5.0",
"webpack": "4.29.6",
"webpack-bundle-analyzer": "3.4.1",
"webpack-merge": "4.1.2",
Expand Down Expand Up @@ -201,7 +201,7 @@
"react-markdown": "^2.5.0",
"react-oembed-container": "^0.3.0",
"react-overlays": "^0.8.3",
"react-relay": "< 7",
"react-relay": "^7.1.0",
"react-relay-network-modern": "^2.5.1",
"react-relay-network-modern-ssr": "^1.2.2",
"react-responsive-decorator": "^0.0.1",
Expand All @@ -216,7 +216,7 @@
"react-url-query": "^1.1.4",
"react-waypoint": "^7.3.3",
"relay-mock-network-layer": "^2.0.0",
"relay-runtime": "< 7",
"relay-runtime": "^7.1.0",
"serialize-javascript": "^1.5.0",
"sharify": "^0.1.6",
"styled-system": "^3.1.11",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/node_modules/@types/react-relay/index.d.ts b/node_modules/@types/react-relay/index.d.ts
index 45e5360..1813ae0 100644
index 62c6c05..d5745e3 100644
--- a/node_modules/@types/react-relay/index.d.ts
+++ b/node_modules/@types/react-relay/index.d.ts
@@ -107,23 +107,28 @@ export {
@@ -109,16 +109,24 @@ export {

export type FetchPolicy = 'store-and-network' | 'network-only';

Expand All @@ -14,7 +14,7 @@ index 45e5360..1813ae0 100644
+}
+
+export interface QueryRendererPropsBase<TOperation extends OperationType> {
environment: Environment;
environment: IEnvironment;
query: GraphQLTaggedNode | null | undefined;
- render: (renderProps: {
- error: Error | null;
Expand All @@ -24,19 +24,21 @@ index 45e5360..1813ae0 100644
+ render: (renderProps: QueryRendererReadyState<TOperation['response']>) => React.ReactNode;
variables: TOperation['variables'];
}
-declare class ReactRelayQueryRenderer<TOperation extends OperationType> extends React.Component<{
+
+export interface QueryRendererProps<TOperation extends OperationType> extends QueryRendererPropsBase<TOperation> {
cacheConfig?: CacheConfig | null;
fetchPolicy?: FetchPolicy;
-} & QueryRendererProps<TOperation>> {}
+ cacheConfig?: CacheConfig | null;
+ fetchPolicy?: FetchPolicy;
+}
+
+declare class ReactRelayQueryRenderer<TOperation extends OperationType> extends React.Component<QueryRendererProps<TOperation>> {}
declare class ReactRelayQueryRenderer<TOperation extends OperationType> extends React.Component<
{
cacheConfig?: CacheConfig | null;
@@ -128,7 +136,7 @@ declare class ReactRelayQueryRenderer<TOperation extends OperationType> extends
export { ReactRelayQueryRenderer as QueryRenderer };

-declare class ReactRelayLocalQueryRenderer<TOperation extends OperationType> extends React.Component<QueryRendererProps<TOperation>> {}
+declare class ReactRelayLocalQueryRenderer<TOperation extends OperationType> extends React.Component<QueryRendererPropsBase<TOperation>> {}
declare class ReactRelayLocalQueryRenderer<TOperation extends OperationType> extends React.Component<
- QueryRendererProps<TOperation>
+QueryRendererPropsBase<TOperation>
> {}
export { ReactRelayLocalQueryRenderer as LocalQueryRenderer };

export const ReactRelayContext: React.Context<RelayContext | null>;
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/node_modules/relay-compiler/bin/relay-compiler b/node_modules/relay-compiler/bin/relay-compiler
index d0ae8f5..3d47c54 100755
index 78b40a3..8d05a9a 100755
--- a/node_modules/relay-compiler/bin/relay-compiler
+++ b/node_modules/relay-compiler/bin/relay-compiler
@@ -335,7 +335,7 @@ function highlightSourceAtLocation(source, location) {
@@ -308,7 +308,7 @@ function highlightSourceAtLocation(source, location) {
var columnOffset = location.line === 1 ? firstLineColumnOffset : 0;
var columnNum = location.column + columnOffset;
var lines = body.split(/\r\n|[\n\r]/g);
Expand All @@ -11,7 +11,7 @@ index d0ae8f5..3d47c54 100755
["".concat(lineNum - 1, ": "), lines[lineIndex - 1]], ["".concat(lineNum, ": "), lines[lineIndex]], ['', whitespace(columnNum - 1) + '^'], ["".concat(lineNum + 1, ": "), lines[lineIndex + 1]]]);
}

@@ -15265,10 +15265,10 @@ module.exports = function (tagFinder) {
@@ -17391,10 +17391,10 @@ module.exports = function (tagFinder) {

var astDefinitions = [];
var sources = [];
Expand All @@ -25,17 +25,14 @@ index d0ae8f5..3d47c54 100755
sources.push(source.body);
astDefinitions.push.apply(astDefinitions, (0, _toConsumableArray2["default"])(ast.definitions));
});
@@ -15352,9 +15352,10 @@ function find(tagFinder, text, absPath) {
@@ -17478,9 +17478,7 @@ function find(tagFinder, text, absPath) {
Copy link
Member

Choose a reason for hiding this comment

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

What do these two patches do and why are they needed?

Copy link
Contributor

@ds300 ds300 Nov 18, 2019

Choose a reason for hiding this comment

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

This relay-compiler patch is to give us 'clickable' file names with correct line:column numbers in error messages.

based on @alloy's PR here: facebook/relay#2752 (which probably won't get merged as-is because it would bust the relay compiler cache of all facebook devs, which apparently is a big deal)

Copy link
Member

Choose a reason for hiding this comment

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

@ds300 so to confirm, if the two patches in this PR were to suddenly go away it would have no effect on application behavior?

Copy link
Contributor

Choose a reason for hiding this comment

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

right 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Although you would have to clear the relay-compiler cache in $TMPDIR

tags.forEach(function (tag) {
return validateTemplate(tag, moduleName, absPath);
});
- return tags.map(function (tag) {
- return tag.template;
- });
+ return tags;
+ // return tags.map(function (tag) {
+ // return tag.template;
+ // });
}

function validateTemplate(_ref, moduleName, filePath) {
1 change: 0 additions & 1 deletion src/Apps/Artist/Routes/Overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ export const ArtistOverviewQuery = graphql`
$medium: String
$offerable: Boolean
$page: Int
$partnerCategory: [String]
$partnerID: ID
$priceRange: String
$sort: String
Expand Down
122 changes: 61 additions & 61 deletions src/__generated__/AcceptTestQuery.graphql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/__generated__/Accept_order.graphql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/__generated__/Articles_artist.graphql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/__generated__/ArtistApp_artist.graphql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/__generated__/ArtistArticles_artist.graphql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.