This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ScreenB | |
const ScreenBQuery = graphql` | |
query ScreenBQuery { | |
root { | |
events(first: $first) { | |
edges { | |
node { | |
title | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case 'store-or-network': { | |
shouldFetch = !hasFullQuery; | |
shouldAllowRender = canPartialRender; | |
break; | |
} | |
// https://github.com/facebook/relay/blob/66e747a68b8fac474fa44b4eb441c72c72daf89e/packages/relay-experimental/QueryResource.js#L392-L395 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_traverse(node: NormalizationNode, dataID: DataID): void { | |
const status = this._mutator.getStatus(dataID); | |
if (status === UNKNOWN) { | |
this._handleMissing(); | |
} | |
if (status === EXISTENT) { | |
this._traverseSelections(node.selections, dataID); | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ScreenA | |
const ScreenAQuery = graphql` | |
query ScreenAQuery { | |
root { | |
me { | |
name | |
} | |
} | |
} | |
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
echo "Rename files" | |
for file in $(find src/ -name "*.js" | grep -v __generated__ | grep -v __tests__); do | |
mv "$file" "${file%.js}.ts" | |
done | |
echo "Removing type import keyword..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const profileInfoViewed = (fromComponent, profile) => { | |
const { id, name, age, homeLocation } = profile; | |
eventsAPI( | |
'ProfileInfoViewed', | |
fromComponent, | |
{ id, name, age, city: homeLocation.title } | |
); | |
}; | |
export const profileInfoViewedFragment = graphql` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ProfileName extends React.Component { | |
componentDidMount() { | |
profileInfoViewed('ProfileName', this.props.profile); | |
} | |
render() { | |
return ( | |
<View> | |
<Text>{this.profile.name}</Text> | |
</View> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ProfileName extends React.Component { | |
componentDidMount() { | |
profileInfoViewed('ProfileName', this.props.profile); | |
} | |
render() { | |
return ( | |
<View> | |
<Text>{this.profile.name}</Text> | |
</View> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const profileInfoViewed = (fromComponent, profile) => { | |
const { id, name, age, homeLocation } = profile; | |
eventsAPI( | |
'ProfileInfoViewed', | |
fromComponent, | |
{ id, name, age, city: homeLocation.title } | |
); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Based on https://github.com/facebook/relay/blob/master/packages/react-relay/modern/ReactRelayQueryRenderer.js | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* |