Skip to content
Permalink
Browse files

Fix broken relay-experimental imports; Add Record: RelayModernRecord …

…to relay-runtime API (#2847)

Summary:
Suggested fix for #2845
Pull Request resolved: #2847

Test Plan:
- jest/flow
- sync to www, test comet there
- build our packages in local copy of repo, verified that ReactRelayContext was properly added to the `react-relay` package.

{F209078094}

Reviewed By: kassens

Differential Revision: D17366489

Pulled By: jstejada

fbshipit-source-id: 3f1d79af296293d1f38201199c220ffaf1d496f0
  • Loading branch information...
babangsund authored and facebook-github-bot committed Sep 13, 2019
1 parent 8319368 commit bf786471c7c9c8a3cc7d027129c36177544f2c45
Showing with 8 additions and 5 deletions.
  1. +1 −0 gulpfile.js
  2. +5 −5 packages/relay-experimental/useRefetchableFragmentNode.js
  3. +2 −0 packages/relay-runtime/index.js
@@ -128,6 +128,7 @@ const builds = [
package: 'react-relay',
exports: {
index: 'index.js',
ReactRelayContext: 'ReactRelayContext.js',
},
bundles: [
{
@@ -530,7 +530,7 @@ if (__DEV__) {
fragmentRefPathInResponse: $ReadOnlyArray<string | number>,
environment: IEnvironment,
): ?DebugIDandTypename {
const RelayModernRecord = require('relay-runtime/store/RelayModernRecord');
const {Record} = require('relay-runtime');
const id = memoRefetchVariables?.id;
if (
fragmentRefPathInResponse.length !== 1 ||
@@ -541,7 +541,7 @@ if (__DEV__) {
}
const recordSource = environment.getStore().getSource();
const record = recordSource.get(id);
const typename = record && RelayModernRecord.getType(record);
const typename = record && Record.getType(record);
if (typename == null) {
return null;
}
@@ -557,13 +557,13 @@ if (__DEV__) {
fragmentNode: ReaderFragment,
componentDisplayName: string,
): void {
const RelayModernRecord = require('relay-runtime/store/RelayModernRecord');
const {Record} = require('relay-runtime');
if (!previousIDAndType) {
return;
}
const recordSource = environment.getStore().getSource();
const record = recordSource.get(previousIDAndType.id);
const typename = record && RelayModernRecord.getType(record);
const typename = record && Record.getType(record);
if (typename !== previousIDAndType.typename) {
warning(
false,
@@ -588,7 +588,7 @@ if (__DEV__) {
if (previousIDAndTypename == null) {
return;
}
const {ID_KEY} = require('relay-runtime/store/RelayStoreUtils');
const {ID_KEY} = require('relay-runtime');
// $FlowExpectedError
const resultID = refetchedFragmentRef[ID_KEY];
if (resultID != null && resultID !== previousIDAndTypename.id) {
@@ -24,6 +24,7 @@ const RelayModernEnvironment = require('./store/RelayModernEnvironment');
const RelayModernFragmentOwner = require('./store/RelayModernFragmentOwner');
const RelayModernGraphQLTag = require('./query/RelayModernGraphQLTag');
const RelayModernOperationDescriptor = require('./store/RelayModernOperationDescriptor');
const RelayModernRecord = require('./store/RelayModernRecord');
const RelayModernSelector = require('./store/RelayModernSelector');
const RelayModernStore = require('./store/RelayModernStore');
const RelayNetwork = require('./network/RelayNetwork');
@@ -221,6 +222,7 @@ module.exports = {
Observable: RelayObservable,
QueryResponseCache: RelayQueryResponseCache,
RecordSource: RelayRecordSource,
Record: RelayModernRecord,
Store: RelayModernStore,

areEqualSelectors: RelayModernSelector.areEqualSelectors,

0 comments on commit bf78647

Please sign in to comment.
You can’t perform that action at this time.