Skip to content
This repository was archived by the owner on Feb 10, 2019. It is now read-only.

[Q] Outdated Relay branch? #284

Closed
kikoseijo opened this issue Feb 1, 2018 · 6 comments
Closed

[Q] Outdated Relay branch? #284

kikoseijo opened this issue Feb 1, 2018 · 6 comments

Comments

@kikoseijo
Copy link

Graz for this awesome package its being of such a great help.

I just have a doubt, as the Relay branch its probably missing new features being incorporated from some time ago, am I right?

Im new into GraphQL, as in lost in concepts, I opted for the Relay branch as I see its a newer feature, with a hope that it was better options.

Haven't had any issues tho, just hoping to get some clarification.

Most people using the normal branch, is this due to a better compatibility with packages like Apollo and others? and im one of the few going for a pure Relay Modern implementations.

Thanks for the TIP!
and Happy coding.

@dmongeau
Copy link
Member

dmongeau commented Feb 2, 2018

@kikoseijo Yes the relay branch is kind of outdated. I was planning to use it as a 1.1 release a year ago but never had the time and most of the pull request for new features were merged in master/develop.

One thing you could do, is use the master branch, but copy the Relay folder of the feature/relay branch. It should work, mostly... Then, maybe do a pull request on the develop branch if you fix some compatibility issue? :) That would be awesome.

@kikoseijo
Copy link
Author

Consider it done! 👍

@4levels
Copy link

4levels commented Mar 15, 2018

Hi @dmongeau,

I'll post my progress here on using the master branch with the Relay features.
After copying the Relay folder from the feature/relay branch, I get the following Exceptions, all related to the visibility of the args(), type() and fields() functions: they are declared protected while they should be public. After changing this, things work almost identical as with the feature/relay branch.
There's also a Console command missing, being called in Relay/Console/NodeMakeCommand.php but since this is just a basic extension, replacing use Folklore\GraphQL\Console\GeneratorCommand; with use Illuminate\Console\GeneratorCommand; fixes this easily.
The same applies for the following Relay Console commands:
ConnectionMakeCommand, InputMakeCommand, MutationMakeCommand & PayloadMakeCommand

I'm still failing to get the actual nodes in the GraphQL response, I'll keep you posted here..

FYI @kikoseijo

Kind regards,

Erik

@4levels
Copy link

4levels commented Mar 15, 2018

Hi @dmongeau & @kikoseijo,

I just created a pull request, merging the Relay folder (with adjustments) into the master branch:
#305
I also created a pull request with the feature/relay branch to see the actual differences: #306

I'm so glad I found the issue! It was only when dumping the query's sql in the resolver method that I could see that the limit was set to 0, explaining why my edges never gave any node results..

Kind regards and thanks again for all the kind support!

Erik

@kikoseijo
Copy link
Author

There are more, I remember had also to touch something to do with how the fields are populated.
This one was working, see what it did to make sure yo cover the 2 3 bits was meant..

https://github.com/kikoseijo/laravel-graphql

@kikoseijo
Copy link
Author

kikoseijo commented Mar 15, 2018

I have this changes made:

TypeIsNode.php

      */
-    public function getFieldsForObjectType()
+    public function getFields()
     {
-        $currentFields = parent::getFieldsForObjectType();
+        $currentFields = parent::getFields();

Relay to Config

    // Relay configuration
    'relay' => [

        // Define the schemas on which you would like to use relay. It will
        // automatically add the node query defined below to those schemas.
        // The parameter can be a string, an array of names or "*" for all schemas.
        'schemas' => '*',

        // The Query class used for the node query
        'query' => [
            'node' => \Folklore\GraphQL\Relay\NodeQuery::class,
            // 'users' => App\GraphQL\Query\UsersQuery::class,
        ],

        // The Type classes used for the Node interface and the PageInfo
        'types' => [
            'Node' => \Folklore\GraphQL\Relay\NodeInterface::class,
            'PageInfo' => \Folklore\GraphQL\Relay\PageInfoType::class,
            // 'User' => App\GraphQL\Type\UserNodeType::class
        ]
    ],

Change scope to public

screen shot 2018-03-15 at 17 46 46

screen shot 2018-03-15 at 17 47 45

screen shot 2018-03-15 at 17 47 22

Replace

-use Folklore\GraphQL\Console\GeneratorCommand;
+use Illuminate\Console\GeneratorCommand;

stubs

  • protected function fields()
  • public function fields()

This is all I have recorded on commits.

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

No branches or pull requests

3 participants