Skip to content

getConnectionNodes is not generated for Queries & non-refetchable Fragments #296

Description

@radion-chernyakov

Hello there!

Are there any reasons for generating getConnectionNodes helper for refetchable fragments only?
From my point of view, it would be nice to have it for both queries and regular fragments as well:

module SomeQuery = %relay(`
  query SomeQuery {
     whateverConnection @connection(key: "SomeConnection") {
       edges {
         node {
            id
          }
        }
      }
    }
  }
`)

let data = SomeQuery.use(~variables=(), ())
let connectionNodes = SomeQuery.getConnectionNodes(data.whateverConnection)

module SomeFragment = %relay(`
  fragment SomeFragment_node on SomeNode {
    whateverConnection @connection(key: "SomeConnection") {
      edges {
        node {
          id
        }
      }
    }
  }
`)

let data = SomeFragment.use(nodeRef)
let connectionNodes = SomeFragment.getConnectionNodes(data.whateverConnection)

Right now, for queries case, I have to wrap everything in the query with refetchable fragment, and for the case of the fragment, I have to make the fragment be refetchable even if I don't need refetch for this fragment.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions