drupal-graphql / drupal-graphql/graphql
Problem with "taxonomyTermContext" and views.
- Dominant language
- PHP
- Stars
- 287
- Forks
- 198
- PR merge metrics
- No merged PRs in 30d
Description
This issue relates to [Issue #2998826](https://www.drupal.org/project/drupal/issues/2998826) on drupal.org so it is currently not an issue until it has been merged.
Basically the problem is that because canonical term pages are generally overridden by views, and the views route has a requirement of _html_ which then causing an exception in the routing because the sub request from GraphQL is using the format __graphql_subrequest_ so it is failing and just returning _null_
The quick fix is to create a new canonical term route like
```example.taxonomy_term.canonical:
path: '/taxonomy/term/{taxonomy_term}'
defaults:
_entity_view: 'taxonomy_term.full'
_title: 'Taxonomy term'
_title_callback: '\Drupal\taxonomy\Controller\TaxonomyController::termTitle'
requirements:
_entity_access: 'taxonomy_term.view'
_format: '_graphql_subrequest'
taxonomy_term: \d+```
but I got the sense from the other issue that other route contexts will be added in the future and this could cause the same problem. I am not sure if there is to extend the views route subscriber to create these automatically.
Also this can be an issue now if you replace `node/{node}` with a view.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.