Skip to content

getSchemaErrors returns undefined #188

@Cellule

Description

@Cellule

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions