Create a new Content View from the Views UI wizard, with a Page display.

Go to the Advanced section, and change the Machine Name of the display from its default value of "page_1" to "page_test".

Save the view.

You will see a message (green!!?!) saying:

The view test has been saved.
Debug:

'setDisplay() called with invalid display ID "page_test".'

in Drupal\views\ViewExecutable->setDisplay() (line 697 of core/modules/views/lib/Drupal/views/ViewExecutable.php).

And below that you will get:

Invalid display id page_test

and an empty Preview. (Screen shot below)

If you go back to Edit on the view you will see that you have just the Master display and the page has gone away.

screen shot of error message

Comments

dawehner’s picture

Status: Active » Needs review
Issue tags: +VDC, +Needs tests
StatusFileSize
new1.07 KB

This fixes the problem for me. I am happy that damian kind of wanted to write tests for this tomorrow.

jhodgdon’s picture

It also fixes the problem for me.

Status: Needs review » Needs work

The last submitted patch, 1: vdc-2169835.patch, failed testing.

jhodgdon’s picture

Status: Needs work » Needs review

1: vdc-2169835.patch queued for re-testing.

jhodgdon’s picture

that was a random bot failure.

damiankloip’s picture

Issue tags: -Needs tests
StatusFileSize
new2.46 KB
new5.44 KB
new5.42 KB

OK, here are some tests for this. It also covers some validation of the form (see fix in validation in patch/diff) we were calling $this->view->display still, when we need to call $this->view->displayHandlers, and iterate over those instead. Also refactored the actual fix in ViewEditFormController too, as I think we can clean that up a bit and call less things.

The last submitted patch, 6: 2169835-6-tests-only-FAIL.patch, failed testing.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

My original patch was just a pointer where to change things. This is way more readable than before.

jhodgdon’s picture

The test-only patch failed with similar errors to what I see without the patch, and reading over the test, it seems very thorough and it definitely tests the bug that is reported here. The patch-with-test patch passes.

I also tested this new patch manually on a clean D8 and it definitely fixes the problem. I also verified that I am not allowed to change the display ID to the same as another display or an illegal name with spaces. Everything seems to be working fine.

The code looks clear to me.

I was going to mark this RTBC but dawehner beat me to it. :)

dries’s picture

Patch looks good, but does not appear to apply. Needs reroll, please.

dries’s picture

6: 2169835-6-PASS.patch queued for re-testing.

dries’s picture

Status: Reviewed & tested by the community » Fixed

Looks like the patch was already committed by catch. Marking it 'fixed' instead.

The last submitted patch, 6: 2169835-6-PASS.patch, failed testing.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.