RickWong / react-transmit

Relay-inspired library based on Promises instead of GraphQL.
BSD 3-Clause "New" or "Revised" License
1.31k stars 61 forks source link

Option to compose queries before sending them #34

Closed brysgo closed 9 years ago

brysgo commented 9 years ago

Can we have getQuery pass a query param so we have the option to return the query string instead of the query response?

myQuery (queryParams) {
  let query = ...
  if (queryParams.prefetch) {
    return Promise.resolve(query);
  } else {
    return fetchQuery(query);
  }
}
RickWong commented 9 years ago

Is this something you cannot solve outside of Transmit? You need to know what type of information is resolved anyways, so for example by returning a small wrapper object { type: "querystring", data } vs. { type: "queryresult", data } instead of just the data.

brysgo commented 9 years ago

yeah, I'll do it that way to keep things simple.