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

Remove RelayCompat from error messages #2663

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 3 additions & 22 deletions packages/react-relay/buildReactRelayContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@ function buildReactRelayContainer<TBase: React$ComponentType<*>>(
if (!isRelayModernEnvironment(environment)) {
throw new Error(
'RelayModernContainer: Can only use Relay Modern component ' +
`${containerName} in a Relay Modern environment!\n` +
'When using Relay Modern and Relay Classic in the same ' +
'application, ensure components use Relay Compat to work in ' +
'both environments.\n' +
'See: http://facebook.github.io/relay/docs/relay-compat.html',
`${containerName} in a Relay Modern environment!`,
);
}
}
Expand Down Expand Up @@ -97,23 +93,8 @@ function buildReactRelayContainer<TBase: React$ComponentType<*>>(
const ForwardContainer = React.forwardRef(forwardRef);

if (__DEV__) {
/* $FlowFixMe(>=0.89.0 site=www,mobile,react_native_fb,oss) Suppressing
* errors found while preparing to upgrade to 0.89.0 */
ForwardContainer.__ComponentClass = ComponentClass;
// Classic container static methods.
/* $FlowFixMe(>=0.89.0 site=www,mobile,react_native_fb,oss) Suppressing
* errors found while preparing to upgrade to 0.89.0 */
ForwardContainer.getFragment = function getFragmentOnModernContainer() {
throw new Error(
`RelayModernContainer: ${containerName}.getFragment() was called on ` +
'a Relay Modern component by a Relay Classic or Relay Compat ' +
'component.\n' +
'When using Relay Modern and Relay Classic in the same ' +
'application, ensure components use Relay Compat to work in ' +
'both environments.\n' +
'See: http://facebook.github.io/relay/docs/relay-compat.html',
);
};
// Used by RelayModernTestUtils
(ForwardContainer: any).__ComponentClass = ComponentClass;
}

/* $FlowFixMe(>=0.89.0 site=www,mobile,react_native_fb,oss) Suppressing errors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,7 @@ describe('Configs: NODE_DELETE', () => {
}),
).toThrowError(
'commitRelayModernMutation: expected `environment` to be an instance of ' +
'`RelayModernEnvironment`.\n' +
'When using Relay Modern and Relay Classic in the same ' +
'application, ensure mutations use Relay Compat to work in ' +
'both environments.\n' +
'See: http://facebook.github.io/relay/docs/relay-compat.html',
'`RelayModernEnvironment`.',
);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ function applyRelayModernOptimisticMutation(
invariant(
isRelayModernEnvironment(environment),
'commitRelayModernMutation: expected `environment` to be an instance of ' +
'`RelayModernEnvironment`.\n' +
'When using Relay Modern and Relay Classic in the same ' +
'application, ensure mutations use Relay Compat to work in ' +
'both environments.\n' +
'See: http://facebook.github.io/relay/docs/relay-compat.html',
'`RelayModernEnvironment`.',
);
const {createOperationDescriptor, getRequest} = environment.unstable_internal;
const mutation = getRequest(config.mutation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ function commitRelayModernMutation<T>(
invariant(
isRelayModernEnvironment(environment),
'commitRelayModernMutation: expected `environment` to be an instance of ' +
'`RelayModernEnvironment`.\n' +
'When using Relay Modern and Relay Classic in the same ' +
'application, ensure mutations use Relay Compat to work in ' +
'both environments.\n' +
'See: http://facebook.github.io/relay/docs/relay-compat.html',
'`RelayModernEnvironment`.',
);
const {createOperationDescriptor, getRequest} = environment.unstable_internal;
const mutation = getRequest(config.mutation);
Expand Down