Contextual filters in view preview UI are not retained on preview navigation

Created on 15 August 2013, over 11 years ago
Updated 13 January 2025, 3 months ago

coming from #2048309: Views UI Preview - navigation is broken , see comment #1 point 3 .

if a contextual filter is specified in the preview textbox, this input gets lost when navigating to a different page on the preview.

Steps to reproduce:

  1. Devel create 50 nodes of type 'article' and 'basic page'
  2. Clone the 'frontpage' view
  3. Change display format to e.g. table, selecting 'title' and 'type' fields as columns in the table
  4. Add a contextual filter to the cloned view, for the 'type' field
  5. Type 'page' in the textbox ifor the contextual filter preview
  6. Click 'Update preview'
  7. You get a table of only 'basic page' nodes
  8. Click any page link in the pager

Expected result:
A second page of 'basic page' nodes

Actual result:
A mix of 'basic page' and 'article' nodes, and the contextual filter textbox is void.

Per #31:

Looks like we may not need to push/pop the request in ViewUI::renderPreview anymore. I think that was relevant when that method was calling drupal_render() so that the pager could use a different 'current' request to build its links. But now, since #2412805: View preview does not attach assets provided by plugins, ViewUI::renderPreview returns a render array, so if we push a request and then pop it within the same method this ends up as a no-op, since the rendering occurs at a later stage.

We can clean up some old stale code to get the expected result.

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component

views_ui.module

Created by

🇮🇹Italy mondrake 🇮🇹

Live updates comments and jobs are added and updated live.
  • VDC

    Related to the Views in Drupal Core initiative.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024