Skip to content

Commit

Permalink
Fix removing __typename when cursor is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
nikugogoi committed Sep 21, 2023
1 parent 48b6488 commit 0b7d3d1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/core/src/event-aggregator/gql-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,18 @@ export class GqlEventAggregatorService extends EventAggregatorService {
variables,
});

// Remove __typename from GQL query result
const {
__typename,
cursor: { __typename: cursorTypename, ...cursor },
cursor: gqlCursor,
...metadata
} = getLogEvents.metadata;
let cursor: Cursor | undefined;

if (gqlCursor) {
const { __typename, ...cursorData } = gqlCursor;
cursor = cursorData;
}

return {
events: getLogEvents.events.map((event: any) => ({
Expand Down Expand Up @@ -360,7 +367,7 @@ export class GqlEventAggregatorService extends EventAggregatorService {
metadata: {
pageEndsAtTimestamp: number;
counts: any[];
cursor: Cursor;
cursor?: Cursor;
isLastPage: boolean;
};
};
Expand Down

0 comments on commit 0b7d3d1

Please sign in to comment.