diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php index 4a53b83..08808e8 100644 --- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php @@ -2365,10 +2365,15 @@ public static function buildBasicRenderable($view_id, $display_id, array $args = '#arguments' => $args, '#embed' => FALSE, '#cache' => [ - 'keys' => ['view', $view_id, 'display', $display_id, 'args', implode(',', $args)], + 'keys' => ['view', $view_id, 'display', $display_id], ], ]; + if ($args) { + $build['#cache']['keys'][] = 'args'; + $build['#cache']['keys'][] = implode(',', $args); + } + $build['#cache_properties'] = ['#view_id', '#view_display_show_admin_links', '#view_display_plugin_id']; return $build; diff --git a/core/modules/views/tests/src/Unit/Routing/ViewPageControllerTest.php b/core/modules/views/tests/src/Unit/Routing/ViewPageControllerTest.php index 4bf01b1..d39ef33 100644 --- a/core/modules/views/tests/src/Unit/Routing/ViewPageControllerTest.php +++ b/core/modules/views/tests/src/Unit/Routing/ViewPageControllerTest.php @@ -80,7 +80,7 @@ public function testPageController() { '#embed' => FALSE, '#arguments' => [], '#cache' => [ - 'keys' => ['views', 'display', 'test_page_view', 'default'], + 'keys' => ['view', 'test_page_view', 'display', 'default'], ], ] + $this->defaultRenderArray; @@ -126,7 +126,7 @@ public function testHandleWithArgumentsWithoutOverridden() { '#embed' => FALSE, '#arguments' => ['test-argument'], '#cache' => [ - 'keys' => ['views', 'display', 'test_page_view', 'page_1'], + 'keys' => ['view', 'test_page_view', 'display', 'page_1', 'args', 'test-argument'], ], ] + $this->defaultRenderArray; @@ -165,7 +165,7 @@ public function testHandleWithArgumentsOnOverriddenRoute() { '#embed' => FALSE, '#arguments' => ['test-argument'], '#cache' => [ - 'keys' => ['views', 'display', 'test_page_view', 'page_1'], + 'keys' => ['view', 'test_page_view', 'display', 'page_1', 'args', 'test-argument'], ], ] + $this->defaultRenderArray; @@ -207,7 +207,7 @@ public function testHandleWithArgumentsOnOverriddenRouteWithUpcasting() { '#embed' => FALSE, '#arguments' => ['example_id'], '#cache' => [ - 'keys' => ['views', 'display', 'test_page_view', 'page_1'], + 'keys' => ['view', 'test_page_view', 'display', 'page_1', 'args', 'example_id'], ], ] + $this->defaultRenderArray;