Problem/Motivation
When using Views Aggregator, something about the pager causes attachments like Data export to break the view. It appears to incorrectly formulate the route to the data export page, missing the view machine name.
Symfony\Component\Routing\Exception\RouteNotFoundException: Route "view..data_export_1" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 206 of core/lib/Drupal/Core/Routing/RouteProvider.php).
Steps to reproduce
- Create a view with a page. Initially have the pager/limit set to 0 (all items), display as a Table with aggregation options. (I didn't need to set any aggregation options, can reproduce just using this display style for the view.) Display whatever you want, the default title field is fine
- Add another display that is a 'Data export'. Attach it to the page, and put in minimal export settings so that you can save it.
- Go back to the 'page' view, may need to clear cache if needed. Observe that the preview works (or check the real view).
- Edit the page and change pager settings to "mini" or "full" pager to limit the options. Observe that the preview no longer refreshes and the view page will not load (error).
For posterity, I switched a couple settings around to make sure it was exactly this combination that causes the problem.
- If the pager shows all, or a limited number of results without a pager, it works.
- If the page displays as a Table, it works.
- Error is the same with or without use of filters, sorts, etc.
Comments
Comment #2
jdhildeb commentedI hit this same issue.
I found that it is related to the "Column aggregation row applies to" setting within Format -> Settings.
If you set "Column aggregation row applies to" to "the page shown" then the error goes away. Switching it back to "the entire result set" causes the error to occur.
Comment #3
tr commentedComment #4
tr commentedIs this related to #3439536: Exposed filters aggregation (regression?) and is this problem fixed by the proposed patch in that issue?
Comment #5
daveonaka commentedI ran into a similar error after update to version 2.1.0 - an existing View with aggregator table had a linked Views Data Export. After update, the Aggregator Plus page did not display and the error message about "route does not exist" appeared. It looks like the database update (after running Drush database update) wipes the path?
Comment #6
tr commentedThe update function did not make any database changes - it only changed the datatypes of three configuration variables used internally to views_aggregator. Specifically, routes and all other configuration variables were left unchanged. Only views that used views_aggregator were changed, and only the displays on those views that used these three configuration variables
I would try to re-save your view, and clear your caches, but I don't see how anything the update did could have affected a route anywhere on your site.
What route in particular is it missing? Is it possible for you to compare an export of the old view and the new view and post that here so I can see what changed?
Comment #7
yonailoI am hitting this issue too, the patch of issue 3439536 does not fix it.
As stated in the original PR, the issue appears when using a pager.
Below is a patch that seems to fix the issue for me.
Comment #8
yonailoComment #9
dieterholvoet commentedHitting the same issue. It's happening because
Drupal\views_aggregator\Plugin\views\style\Table::preRender()creates a duplicate and executes it without saving. Down the line, inDrupal\views_data_export\Plugin\views\display\DataExport::attachTo(),$view->getUrl()is called and fails because the attached view doesn't have an ID yet, because it is new and unsaved.I'm able to fix this in Views data export by calling
isNew()before trying to generate an url. I believe that's the way to go, so I'm moving this issue to that project.Comment #11
dieterholvoet commentedComment #13
steven jones commentedThere's actually a method on
\Drupal\views\ViewExecutablethat tells us if there's a URL, I wonder if that's what we need to check here?@dieterholvoet are you able to test this MR I'm about to open please?
Comment #15
steven jones commentedComment #16
tlwatsonI was able to test your MR in my issue case - it works! I don't see any regressions in my other export views either.
Comment #17
vladimirausTesting (Drupal 10 and latest version of module) after getting
After applying MR69 I'm getting
Error: Call to undefined method Drupal\views\Plugin\views\style\Table::getFormats() in Drupal\rest\Plugin\views\display\RestExport->collectRoutes() (line 353 of core/modules/rest/src/Plugin/views/display/RestExport.php).Comment #18
vladimirausWith 2nd error I might have hit #2955378: Fatal error on Drupal 8.5, on a data_export display that uses not the data_export style but the *default* style where I need to change the view format.
Comment #19
vladimirausComment #20
steven jones commentedComment #22
steven jones commentedThanks everyone!