File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
packages/graphqlsp/src/ast Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @0no-co/graphqlsp ' : patch
3+ ---
4+
5+ Fix fragments not being resolved when they're assigned to a property on an arbitrary identifier as an identifier.
Original file line number Diff line number Diff line change @@ -70,6 +70,8 @@ function unrollFragment(
7070 let found = findNode ( externalSource , fragment . textSpan . start ) ;
7171 if ( ! found ) return fragments ;
7272
73+ while ( ts . isPropertyAccessExpression ( found . parent ) ) found = found . parent ;
74+
7375 if (
7476 ts . isVariableDeclaration ( found . parent ) &&
7577 found . parent . initializer &&
@@ -78,6 +80,14 @@ function unrollFragment(
7880 found = found . parent . initializer ;
7981 } else if ( ts . isPropertyAssignment ( found . parent ) ) {
8082 found = found . parent . initializer ;
83+ } else if ( ts . isBinaryExpression ( found . parent ) ) {
84+ found = found . parent . right ;
85+ }
86+
87+ // If we found another identifier, we repeat trying to find the original
88+ // fragment definition
89+ if ( ts . isIdentifier ( found ) ) {
90+ return unrollFragment ( found , info , typeChecker ) ;
8191 }
8292
8393 // Check whether we've got a `graphql()` or `gql()` call, by the
You can’t perform that action at this time.
0 commit comments