Skip to content

Commit

Permalink
change ternary back to if
Browse files Browse the repository at this point in the history
  • Loading branch information
radiden committed Sep 6, 2024
1 parent 6f9eadc commit 81d1ebb
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions packages/houdini/src/codegen/transforms/paginate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,19 @@ function objectNode([type, defaultValue]: [
string,
number | string | undefined
]): graphql.ObjectValueNode {
let defaultValueNode: graphql.ObjectFieldNode[] = []
if (defaultValue) {
defaultValueNode = [
{
kind: graphql.Kind.OBJECT_FIELD,
name: { kind: graphql.Kind.NAME, value: 'default' },
value: {
kind: typeof defaultValue === 'number' ? graphql.Kind.INT : graphql.Kind.STRING,
value: defaultValue.toString(),
},
},
]
}
const node: graphql.ObjectValueNode = {
kind: graphql.Kind.OBJECT,
fields: [
Expand All @@ -702,21 +715,7 @@ function objectNode([type, defaultValue]: [
value: type,
},
},
...(defaultValue
? ([
{
kind: graphql.Kind.OBJECT_FIELD,
name: { kind: graphql.Kind.NAME, value: 'default' },
value: {
kind:
typeof defaultValue === 'number'
? graphql.Kind.INT
: graphql.Kind.STRING,
value: defaultValue.toString(),
},
},
] as graphql.ObjectFieldNode[])
: []),
...defaultValueNode,
],
}

Expand Down

0 comments on commit 81d1ebb

Please sign in to comment.