You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently pgSelect yields an array of tuples. But sometimes we need to know extra information from this, such as "does it have more rows available". Currently we do this, disgustingly, by adding a .hasMore property to the array. This is hideous because it means V8 can no longer treat it as a pure array, and also because no-one expects arrays to have extra properties...
Anyway; on top of that, with #2326 we can no longer evaluate first/last/etc up front and so we pass them through to runtime. But because "hasNextPage" is now dependent on the result of the PgSelect (and no longer forks beforehand), the PgSelect has to run and yield an array of results just so that for a query like
we can determine there is no previous/next page. The system cannot determine that we only need the "hasMore" property and don't actually need to perform the select, and that we never iterate over the array, so it has to perform the fetch even though it's not used.
I think that we want PgSelect to actually yield an object containing the list of rows and meta information; and if the rows are never requested then no need to fetch them. I.e.:
Currently pgSelect yields an array of tuples. But sometimes we need to know extra information from this, such as "does it have more rows available". Currently we do this, disgustingly, by adding a
.hasMore
property to the array. This is hideous because it means V8 can no longer treat it as a pure array, and also because no-one expects arrays to have extra properties...Anyway; on top of that, with #2326 we can no longer evaluate first/last/etc up front and so we pass them through to runtime. But because "hasNextPage" is now dependent on the result of the PgSelect (and no longer forks beforehand), the PgSelect has to run and yield an array of results just so that for a query like
crystal/grafast/dataplan-pg/__tests__/queries/connections/empty.test.graphql
Lines 6 to 11 in 6c2923c
we can determine there is no previous/next page. The system cannot determine that we only need the "hasMore" property and don't actually need to perform the select, and that we never iterate over the array, so it has to perform the fetch even though it's not used.
I think that we want PgSelect to actually yield an object containing the list of rows and meta information; and if the rows are never requested then no need to fetch them. I.e.:
This would be quite a big, breaking change (albeit fairly easy to migrate to), so if we're to do this we should do it before the launch of V5.
The text was updated successfully, but these errors were encountered: