Skip to content

Commit

Permalink
FAI-5239: v2 flows not working (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
ted-faros committed Feb 17, 2023
1 parent d3322eb commit 629d3cb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/graphql/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,15 @@ export function paginatedQuery(query: string): PaginatedQuery {
};
}

export function paginatedQueryV2(query: string): PaginatedQuery {
return process.env.GRAPHQL_V2_PAGINATOR === 'relay' ?
paginatedWithRelayV2(query) : paginateWithOffsetLimitV2(query);
}

/**
* Paginates v2 graphql queries.
*/
export function paginatedQueryV2(query: string): PaginatedQuery {
export function paginatedWithRelayV2(query: string): PaginatedQuery {
const edgesPath: string[] = [];
const pageInfoPath: string[] = [];
let firstNode = true;
Expand Down Expand Up @@ -1077,8 +1082,7 @@ export function createNonIncrementalReaders(
pageSize,
graphSchema,
false,
process.env.GRAPHQL_V2_PAGINATOR === 'relay' ?
paginatedQueryV2 : paginateWithOffsetLimitV2,
paginatedQueryV2,
flattenV2
);
default:
Expand Down
4 changes: 2 additions & 2 deletions test/graphql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ describe('graphql', () => {
expect(await toArray(flattenedNodes)).toMatchSnapshot();
});

test('paginated v2 query', async () => {
test('paginated relay v2 query', async () => {
const query = await loadQueryFile('commits-v2.gql');
const expectedQuery = await loadQueryFile('paginated-commits-v2.gql');
const paginatedQuery = sut.paginatedQueryV2(query);
const paginatedQuery = sut.paginatedWithRelayV2(query);
expect(paginatedQuery.edgesPath).toEqual([
'vcs_Commit_connection',
'edges',
Expand Down

0 comments on commit 629d3cb

Please sign in to comment.