Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getSchemaErrors returns undefined #188

Open
Cellule opened this issue May 14, 2021 · 0 comments
Open

getSchemaErrors returns undefined #188

Cellule opened this issue May 14, 2021 · 0 comments

Comments

@Cellule
Copy link

Cellule commented May 14, 2021

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @playlyfe/gql@2.6.2 for the project I'm working on.

I didn't dig deeper, but I got an error very early when using vs code extension graphql-for-vscode which uses this project.
From what I can tell if getSchemaErrors is called before _updateFiles in GQLSchemaBuilder it could lead to _errors to be undefined.

Here is the diff that solved my problem:

diff --git a/node_modules/@playlyfe/gql/lib/GQLService.js b/node_modules/@playlyfe/gql/lib/GQLService.js
index ed4507e..31ee161 100644
--- a/node_modules/@playlyfe/gql/lib/GQLService.js
+++ b/node_modules/@playlyfe/gql/lib/GQLService.js
@@ -117,7 +117,7 @@ var GQLService = exports.GQLService = function () {
       if (!this._isInitialized) {
         return [];
       }
-      var schemaErrors = this._schemaBuilder.getSchemaErrors();
+      var schemaErrors = this._schemaBuilder.getSchemaErrors() || [];
       var queryErrors = this._queryManager ? this._queryManager.getErrors() : [];
       return schemaErrors.concat(queryErrors.filter(function (err) {
         return Boolean(err);

This issue body was partially generated by patch-package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant