Problem/Motivation
Getting an error on views preview of type graphql when there are no items to list. Showing the error message on views page "Oops, something went wrong. Check your browser's developer console for more details.". And getting the following error in recent log messages
TypeError: array_keys(): Argument #1 ($array) must be of type array, false given in array_keys() (line 418 of /var/www/html/web/modules/contrib/graphql_compose/modules/graphql_compose_views/src/Plugin/views/display/GraphQL.php).
#0 /var/www/html/web/modules/contrib/graphql_compose/modules/graphql_compose_views/src/Plugin/views/display/GraphQL.php(418): array_keys()
#1 /var/www/html/web/core/modules/views/src/ViewExecutable.php(1592): Drupal\graphql_compose_views\Plugin\views\display\GraphQL->render()
#2 /var/www/html/web/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php(2467): Drupal\views\ViewExecutable->render()
#3 /var/www/html/web/core/modules/views/src/ViewExecutable.php(1721): Drupal\views\Plugin\views\display\DisplayPluginBase->preview()
#4 /var/www/html/web/core/modules/views_ui/src/ViewUI.php(617): Drupal\views\ViewExecutable->preview()
#5 /var/www/html/web/core/modules/views_ui/src/ViewPreviewForm.php(63): Drupal\views_ui\ViewUI->renderPreview()
#6 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityForm.php(107): Drupal\views_ui\ViewPreviewForm->form()
#7 /var/www/html/web/core/modules/views_ui/src/ViewFormBase.php(42): Drupal\Core\Entity\EntityForm->buildForm()
#8 [internal function]: Drupal\views_ui\ViewFormBase->buildForm()
#9 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(536): call_user_func_array()
#10 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(375): Drupal\Core\Form\FormBuilder->retrieveForm()
#11 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(633): Drupal\Core\Form\FormBuilder->rebuildForm()
#12 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(326): Drupal\Core\Form\FormBuilder->processForm()
#13 /var/www/html/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()
#14 [internal function]: Drupal\Core\Controller\FormController->getContentResult()
#15 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#16 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(638):
Steps to reproduce
Create a view. Add a graphql type display. Add filters so that there wont be any results to show (in my case its using arguments). Click "Update preview" button. The error appears.
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork graphql_compose-3503311
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #8
sijumpk commentedComment #9
almunningsComment #10
almunningsGreat catch
Thank you
Comment #12
almunningsMerged pending 2.3 release
Comment #13
almunnings