nuwave / lighthouse

A framework for serving GraphQL from Laravel
https://lighthouse-php.com
MIT License
3.37k stars 439 forks source link

Executing the same create mutation twice in a row gives 'undefined offset: {id of just created record}' #1036

Closed JoepvdBroek closed 5 years ago

JoepvdBroek commented 5 years ago

Describe the bug

Executing the same create mutation twice in a row gives 'undefined offset: {id of just created record}'

Steps to reproduce

  1. We have a normal create mutation
    mutation {
    createOrganizationInvitation(input: {
    organization: {connect: ' . $organization_id . '}
    eMailAddress: "' . $e_mail_address . '"
    invitingUser:  {connect: ' . $user->id . '}
    }) {
    id
    eMailAddress
    organizationInvitationAction
    }
    }
  2. We have a test calling this mutation twice (with different eMailAddresses)
  3. The second one will give following error

Output/Logs

Click to expand ``` array ( 'errors' => array ( 0 => array ( 'debugMessage' => 'Undefined offset: 4', 'message' => 'Internal server error', 'extensions' => array ( 'category' => 'internal', ), 'locations' => array ( 0 => array ( 'line' => 9, 'column' => 17, ), ), 'path' => array ( 0 => 'createOrganizationInvitation', 1 => 'organizationInvitationAction', ), 'trace' => array ( 0 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/nuwave/lighthouse/src/Execution/DataLoader/BatchLoader.php', 'line' => 115, 'call' => 'Illuminate\\Foundation\\Bootstrap\\HandleExceptions::handleError(8, \'Undefined offset: 4\', \'/home/joep/repos/scorecardapi/vendor/nuwave/lighthouse/src/Execution/DataLoader/BatchLoader.php\', 115, array(1))', ), 1 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/webonyx/graphql-php/src/Deferred.php', 'line' => 58, 'call' => 'Nuwave\\Lighthouse\\Execution\\DataLoader\\BatchLoader::Nuwave\\Lighthouse\\Execution\\DataLoader\\{closure}()', ), 2 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/webonyx/graphql-php/src/Deferred.php', 'line' => 45, 'call' => 'GraphQL\\Deferred::run()', ), 3 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/webonyx/graphql-php/src/Executor/Promise/Adapter/SyncPromiseAdapter.php', 'line' => 153, 'call' => 'GraphQL\\Deferred::runQueue()', ), 4 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/webonyx/graphql-php/src/GraphQL.php', 'line' => 101, 'call' => 'GraphQL\\Executor\\Promise\\Adapter\\SyncPromiseAdapter::wait(instance of GraphQL\\Executor\\Promise\\Promise)', ), 5 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/nuwave/lighthouse/src/GraphQL.php', 'line' => 177, 'call' => 'GraphQL\\GraphQL::executeQuery(instance of GraphQL\\Type\\Schema, \'mutation { createOrganizationInvitation(input: { organization: {connect: 2} eMailAddress: "vwitting@example.com" invitingUser: {connect: 14} }) { id eMailAddress organizationInvitationAction } }\', null, instance of Nuwave\\Lighthouse\\Schema\\Context, array(0), null, null, array(29))', ), 6 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/nuwave/lighthouse/src/GraphQL.php', 'line' => 116, 'call' => 'Nuwave\\Lighthouse\\GraphQL::executeQuery(\'mutation { createOrganizationInvitation(input: { organization: {connect: 2} eMailAddress: "vwitting@example.com" invitingUser: {connect: 14} }) { id eMailAddress organizationInvitationAction } }\', instance of Nuwave\\Lighthouse\\Schema\\Context, array(0), null, null)', ), 7 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/nuwave/lighthouse/src/Support/Http/Controllers/GraphQLController.php', 'line' => 70, 'call' => 'Nuwave\\Lighthouse\\GraphQL::executeRequest(instance of Nuwave\\Lighthouse\\Execution\\LighthouseRequest)', ), 8 => array ( 'call' => 'Nuwave\\Lighthouse\\Support\\Http\\Controllers\\GraphQLController::query(instance of Nuwave\\Lighthouse\\Execution\\LighthouseRequest)', ), 9 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Routing/Controller.php', 'line' => 54, 'function' => 'call_user_func_array(array(2), array(1))', ), 10 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php', 'line' => 45, 'call' => 'Illuminate\\Routing\\Controller::callAction(\'query\', array(1))', ), 11 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Routing/Route.php', 'line' => 219, 'call' => 'Illuminate\\Routing\\ControllerDispatcher::dispatch(instance of Illuminate\\Routing\\Route, instance of Nuwave\\Lighthouse\\Support\\Http\\Controllers\\GraphQLController, \'query\')', ), 12 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Routing/Route.php', 'line' => 176, 'call' => 'Illuminate\\Routing\\Route::runController()', ), 13 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Routing/Router.php', 'line' => 680, 'call' => 'Illuminate\\Routing\\Route::run()', ), 14 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php', 'line' => 30, 'call' => 'Illuminate\\Routing\\Router::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)', ), 15 => array ( 'file' => '/home/joep/repos/scorecardapi/app/Http/Middleware/CheckJWT.php', 'line' => 39, 'call' => 'Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)', ), 16 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line' => 163, 'call' => 'App\\Http\\Middleware\\CheckJWT::handle(instance of Illuminate\\Http\\Request, instance of Closure)', ), 17 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php', 'line' => 53, 'call' => 'Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)', ), 18 => array ( 'file' => '/home/joep/repos/scorecardapi/app/Http/Middleware/ModelUnguard.php', 'line' => 14, 'call' => 'Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)', ), 19 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line' => 163, 'call' => 'App\\Http\\Middleware\\ModelUnguard::handle(instance of Illuminate\\Http\\Request, instance of Closure)', ), 20 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php', 'line' => 53, 'call' => 'Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)', ), 21 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/nuwave/lighthouse/src/Support/Http/Middleware/AcceptJson.php', 'line' => 30, 'call' => 'Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)', ), 22 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line' => 163, 'call' => 'Nuwave\\Lighthouse\\Support\\Http\\Middleware\\AcceptJson::handle(instance of Illuminate\\Http\\Request, instance of Closure)', ), 23 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php', 'line' => 53, 'call' => 'Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)', ), 24 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line' => 104, 'call' => 'Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)', ), 25 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Routing/Router.php', 'line' => 682, 'call' => 'Illuminate\\Pipeline\\Pipeline::then(instance of Closure)', ), 26 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Routing/Router.php', 'line' => 657, 'call' => 'Illuminate\\Routing\\Router::runRouteWithinStack(instance of Illuminate\\Routing\\Route, instance of Illuminate\\Http\\Request)', ), 27 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Routing/Router.php', 'line' => 623, 'call' => 'Illuminate\\Routing\\Router::runRoute(instance of Illuminate\\Http\\Request, instance of Illuminate\\Routing\\Route)', ), 28 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Routing/Router.php', 'line' => 612, 'call' => 'Illuminate\\Routing\\Router::dispatchToRoute(instance of Illuminate\\Http\\Request)', ), 29 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php', 'line' => 176, 'call' => 'Illuminate\\Routing\\Router::dispatch(instance of Illuminate\\Http\\Request)', ), 30 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php', 'line' => 30, 'call' => 'Illuminate\\Foundation\\Http\\Kernel::Illuminate\\Foundation\\Http\\{closure}(instance of Illuminate\\Http\\Request)', ), 31 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php', 'line' => 49, 'call' => 'Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)', ), 32 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line' => 163, 'call' => 'Illuminate\\View\\Middleware\\ShareErrorsFromSession::handle(instance of Illuminate\\Http\\Request, instance of Closure)', ), 33 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php', 'line' => 53, 'call' => 'Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)', ), 34 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php', 'line' => 56, 'call' => 'Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)', ), 35 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line' => 163, 'call' => 'Illuminate\\Session\\Middleware\\StartSession::handle(instance of Illuminate\\Http\\Request, instance of Closure)', ), 36 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php', 'line' => 53, 'call' => 'Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)', ), 37 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/fideloper/proxy/src/TrustProxies.php', 'line' => 57, 'call' => 'Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)', ), 38 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line' => 163, 'call' => 'Fideloper\\Proxy\\TrustProxies::handle(instance of Illuminate\\Http\\Request, instance of Closure)', ), 39 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php', 'line' => 53, 'call' => 'Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)', ), 40 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php', 'line' => 21, 'call' => 'Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)', ), 41 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line' => 163, 'call' => 'Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest::handle(instance of Illuminate\\Http\\Request, instance of Closure)', ), 42 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php', 'line' => 53, 'call' => 'Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)', ), 43 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php', 'line' => 21, 'call' => 'Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)', ), 44 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line' => 163, 'call' => 'Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest::handle(instance of Illuminate\\Http\\Request, instance of Closure)', ), 45 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php', 'line' => 53, 'call' => 'Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)', ), 46 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php', 'line' => 27, 'call' => 'Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)', ), 47 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line' => 163, 'call' => 'Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize::handle(instance of Illuminate\\Http\\Request, instance of Closure)', ), 48 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php', 'line' => 53, 'call' => 'Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)', ), 49 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php', 'line' => 62, 'call' => 'Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)', ), 50 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line' => 163, 'call' => 'Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode::handle(instance of Illuminate\\Http\\Request, instance of Closure)', ), 51 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php', 'line' => 53, 'call' => 'Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)', ), 52 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php', 'line' => 104, 'call' => 'Illuminate\\Routing\\Pipeline::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)', ), 53 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php', 'line' => 151, 'call' => 'Illuminate\\Pipeline\\Pipeline::then(instance of Closure)', ), 54 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php', 'line' => 116, 'call' => 'Illuminate\\Foundation\\Http\\Kernel::sendRequestThroughRouter(instance of Illuminate\\Http\\Request)', ), 55 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php', 'line' => 375, 'call' => 'Illuminate\\Foundation\\Http\\Kernel::handle(instance of Illuminate\\Http\\Request)', ), 56 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php', 'line' => 347, 'call' => 'Illuminate\\Foundation\\Testing\\TestCase::call(\'POST\', \'graphql\', array(0), array(0), array(0), array(3), \'{"query":"mutation {\\n createOrganizationInvitation(input: {\\n organization: {connect: 2}\\n eMailAddress: \\"vwitting@example.com\\"\\n invitingUser: {connect: 14}\\n }) {\\n id\\n eMailAddress\\n organizationInvitationAction\\n }\\n }"}\')', ), 57 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php', 'line' => 210, 'call' => 'Illuminate\\Foundation\\Testing\\TestCase::json(\'POST\', \'graphql\', array(1), array(3))', ), 58 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/nuwave/lighthouse/src/Testing/MakesGraphQLRequests.php', 'line' => 84, 'call' => 'Illuminate\\Foundation\\Testing\\TestCase::postJson(\'graphql\', array(1), array(0))', ), 59 => array ( 'file' => '/home/joep/repos/scorecardapi/Modules/ScorecardApi/Tests/Feature/GraphQLOrganizationInvitationTest.php', 'line' => 71, 'call' => 'Modules\\ScorecardApi\\Tests\\Feature\\GraphQLOrganizationInvitationTest::postGraphQL(array(1))', ), 60 => array ( 'file' => '/home/joep/repos/scorecardapi/Modules/ScorecardApi/Tests/Feature/GraphQLOrganizationInvitationTest.php', 'line' => 362, 'call' => 'Modules\\ScorecardApi\\Tests\\Feature\\GraphQLOrganizationInvitationTest::runCreateOrganizationInvitation(instance of Modules\\Base\\Entities\\User, 2, \'vwitting@example.com\')', ), 61 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/phpunit/phpunit/src/Framework/TestCase.php', 'line' => 1154, 'call' => 'Modules\\ScorecardApi\\Tests\\Feature\\GraphQLOrganizationInvitationTest::test_removeOrganizationMemberMutationMemberByMember()', ), 62 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/phpunit/phpunit/src/Framework/TestCase.php', 'line' => 842, 'call' => 'PHPUnit\\Framework\\TestCase::runTest()', ), 63 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/phpunit/phpunit/src/Framework/TestResult.php', 'line' => 693, 'call' => 'PHPUnit\\Framework\\TestCase::runBare()', ), 64 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/phpunit/phpunit/src/Framework/TestCase.php', 'line' => 796, 'call' => 'PHPUnit\\Framework\\TestResult::run(instance of Modules\\ScorecardApi\\Tests\\Feature\\GraphQLOrganizationInvitationTest(1))', ), 65 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/phpunit/phpunit/src/Framework/TestSuite.php', 'line' => 746, 'call' => 'PHPUnit\\Framework\\TestCase::run(instance of PHPUnit\\Framework\\TestResult(1))', ), 66 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/phpunit/phpunit/src/TextUI/TestRunner.php', 'line' => 652, 'call' => 'PHPUnit\\Framework\\TestSuite::run(instance of PHPUnit\\Framework\\TestResult(1))', ), 67 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/phpunit/phpunit/src/TextUI/Command.php', 'line' => 206, 'call' => 'PHPUnit\\TextUI\\TestRunner::doRun(instance of PHPUnit\\Framework\\TestSuite(1), array(63), true)', ), 68 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/phpunit/phpunit/src/TextUI/Command.php', 'line' => 162, 'call' => 'PHPUnit\\TextUI\\Command::run(array(8), true)', ), 69 => array ( 'file' => '/home/joep/repos/scorecardapi/vendor/phpunit/phpunit/phpunit', 'line' => 61, 'call' => 'PHPUnit\\TextUI\\Command::main()', ), ), ), ), 'data' => array ( 'createOrganizationInvitation' => array ( 'id' => 4, 'eMailAddress' => 'vwitting@example.com', 'organizationInvitationAction' => NULL, ), ), 'extensions' => array ( 'lighthouse_subscriptions' => array ( 'version' => 1, 'channels' => array ( ), ), ), ) ```

**What I did for temporary fix** `Load` method of `Execution/DataLoader/BatchLoader` has his variable hasLoaded set to true. So it doesn't call resolve again, but we just create a new record and that record won't be in the current results. I removed the hasLoaded check. **What also feels wrong is that even though create mutations return the just created record, why does this batchloader load ALL records? I could be wrong, but could someone elaborate for me?** ``` public function load($key, array $metaInfo = []): Deferred { $key = $this->buildKey($key); $this->keys[$key] = $metaInfo; return new Deferred(function () use ($key) { //if (! $this->hasLoaded) { $this->results = $this->resolve(); //$this->hasLoaded = true; //} return $this->results[$key]; }); } ``` **Environment** Lighthouse Version: ^4.3 Laravel Version: 5.8.*
enzonotario commented 5 years ago

Hey! yes, I think it's related to #1030 and yes, commenting the line you indicate, it also works (but maybe it brokes another part)

JoepvdBroek commented 5 years ago

I doubt it breaks anything, but It will lower performance seeing as it will always call the resolve method instead of being "cached"

What about What also feels wrong to me, is that even though the create mutations returns just the created record, why does this batchloader load ALL records? I could be wrong, but could someone elaborate for me?

enzonotario commented 5 years ago

I think it's loading those relations because you are connecting some of them to your record created by the mutation, although the query doesn't fetch them... If you test a simple mutation (without connections) twice, it will work.