How to use the react-relay.createRefetchContainer function in react-relay

To help you get started, we’ve selected a few react-relay examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sibelius / relay-modern-course / packages / 10-include-skip / IncludeExample.js View on Github external
)
  };

  return (
    <div>
      <span>{post.title}</span>
      <span>{post.description}</span>
      <button>
        Show comments
      </button>
      {renderComments()}
    </div>
  );
};

const PostRefetchContainer = createRefetchContainer(
  Post,
  {
    post: graphql`
      fragment Post_post on Post
      @argumentDefinition(
        showComments: { type: "Boolean!", defaultValue: false }
      ) {
        id
        title
        description
        comments(
          first: 10
        ) @include(if: $showComments) {
          edges {
            node {
              id
github jaburx / pantheon-app / src / screens / Events / EventsScreen.js View on Github external
onEndReached={this.onEndReached}
          ListEmptyComponent={}
        /&gt;
         this.props.navigation.navigate(ROUTENAMES.EVENT_ADD)} /&gt;
         this.changeDistance(distance)}
          closeDistanceModal={() =&gt; this.setState({ isDistanceModalVisible: false })}
        /&gt;
      
    );
  }
}

const EventsScreenRefetchContainer = createRefetchContainer(
  EventsScreen,
  {
    query: graphql`
      fragment EventsScreen_query on Query @argumentDefinitions(
          search: { type: String }
          coordinates: { type: "[Float]" }
          distance: { type: Int }
          first: { type: Int, defaultValue: 10 }
          cursor: { type: String }
        ) {
        events(
          first: $first,
          after: $cursor
          search: $search,
          coordinates: $coordinates,
          distance: $distance
github artsy / reaction / src / Apps / Artist / Routes / AuctionResults / ArtistAuctionResults.tsx View on Github external
onClick={this.loadAfter}
                      onNext={this.loadNext}
                      scrollTo="#jumpto-ArtistHeader"
                    /&gt;
                  
                
              
            
          )
        }}
      
    )
  }
}

export const ArtistAuctionResultsRefetchContainer = createRefetchContainer(
  (props: AuctionResultsProps) =&gt; {
    return (
      
        {({ state }: AuctionResultsState) =&gt; {
          return 
        }}
      
    )
  },
  {
    artist: graphql`
      fragment ArtistAuctionResults_artist on Artist
        @argumentDefinitions(
          sort: { type: "AuctionResultSorts", defaultValue: DATE_DESC }
          first: { type: "Int", defaultValue: 10 }
          last: { type: "Int" }
github artsy / reaction / src / Apps / Search / Routes / Artists / SearchResultsArtists.tsx View on Github external
const artists = get(viewer, v =&gt; v.search.edges, []).map(e =&gt; e.node)
    return (
      
        {artists.length === 0 ? (
          
            
          
        ) : (
          this.renderArtists()
        )}
      
    )
  }
}

export const SearchResultsArtistsRouteFragmentContainer = createRefetchContainer(
  SearchResultsArtistsRoute,
  {
    viewer: graphql`
      fragment SearchResultsArtists_viewer on Viewer
        @argumentDefinitions(
          term: { type: "String!", defaultValue: "" }
          first: { type: "Int", defaultValue: 10 }
          last: { type: "Int" }
          after: { type: "String" }
          before: { type: "String" }
          page: { type: "Int" }
        ) {
        search(
          query: $term
          first: $first
          after: $after
github artsy / emission / src / lib / Scenes / Partner / Partner.tsx View on Github external
)
  }
}

export const PartnerContainer = createRefetchContainer(
  Partner,
  {
    partner: graphql`
      fragment Partner_partner on Partner {
        id
        slug
        profile {
          id
          isFollowed
          internalID
        }

        ...PartnerArtwork_partner
        ...PartnerOverview_partner
        ...PartnerShows_partner
        ...PartnerHeader_partner
github artsy / reaction / src / Apps / Artwork / Components / OtherWorks / ArtworkContexts / ArtworkGrids / RelatedWorksArtworkGrid.tsx View on Github external
preloadImageCount={0}
                      mediator={mediator}
                      onBrickClick={this.trackBrickClick.bind(this)}
                    /&gt;
                  )}
                
              
            )
          })}
        
      
    )
  }
}

export const RelatedWorksArtworkGridRefetchContainer = createRefetchContainer&lt;
  RelatedWorksArtworkGridProps
&gt;(
  withSystemContext(RelatedWorksArtworkGrid),
  {
    artwork: graphql`
      fragment RelatedWorksArtworkGrid_artwork on Artwork
        @argumentDefinitions(layerId: { type: "String" }) {
        layers {
          name
          id
        }
        layer(id: $layerId) {
          name
          artworksConnection(first: 8) {
            ...ArtworkGrid_artworks
github bochen2014 / relay-todo-modern / client / components / TodoWithDetails.js View on Github external
relay.refetch({
      showDetails: true,
      id,
    });
  };
  return (
    <div>
      <span>{text + ' status: ' + status}</span>
      <span><button>check details</button></span>
      {details &amp;&amp; <span style="{{"> {details}</span>}
    </div>
  );
};


export default createRefetchContainer(TodoWithDetails,
  graphql`fragment TodoWithDetails_todo on Todo
      @argumentDefinitions(
          showDetails:{
            type:"Boolean!",
            defaultValue:false
          }
      ){
        id
        text
        status
        details @include(if: $showDetails)
    }`,
  graphql`
    query TodoWithDetailsBoChenRefetchQuery($id: ID!, $showDetails: Boolean!){
        node(id: $id){
          ... TodoWithDetails_todo @arguments(showDetails:$showDetails)
github OpenCTI-Platform / opencti / opencti-platform / opencti-front / src / private / components / connectors / ConnectorsStatus.js View on Github external
}

ConnectorsStatusComponent.propTypes = {
  classes: PropTypes.object,
  t: PropTypes.func,
  nsdt: PropTypes.func,
  data: PropTypes.object,
};

export const connectorsStatusQuery = graphql`
  query ConnectorsStatusQuery {
    ...ConnectorsStatus_data
  }
`;

const ConnectorsStatus = createRefetchContainer(
  ConnectorsStatusComponent,
  {
    data: graphql`
      fragment ConnectorsStatus_data on Query {
        connectors {
          id
          name
          active
          connector_type
          connector_scope
          updated_at
        }
      }
    `,
  },
  connectorsStatusQuery,
github coralproject / talk / src / core / client / framework / lib / relay / withRefetchContainer.ts View on Github external
&gt; =&gt; (component: React.ComponentType) =&gt;
  createRefetchContainer(component, fragmentSpec, refetchQuery) as any;
github ncrmro / rjango / client / modules / polls / Polls.js View on Github external
heading='Polls'
  &gt;
    <p>This is the polls app</p>
    <ul>

      {props.viewer.questions.edges ? props.viewer.questions.edges.map(
        ({ node }) =&gt;
          <li>
            
          </li>
      ) : 'loading..'}
    </ul>
  


const PollsListRefetchContainer = createRefetchContainer(PollsList, {
    viewer: graphql.experimental`
        fragment Polls_viewer on Viewer
        @argumentDefinitions(
            first: {type: "Int", defaultValue: 10},
        )
        {
            questions(first: $first){
                edges {
                    node {
                        id
                        ...Polls_question
                    }
                }
            }
        }
    `