Problem/Motivation

There's a white screen of death in Views UI when viewing View that doesn't have any displays.

Steps to reproduce:

  • Open /admin/structure/views/view/who_s_new
  • Delete the view
  • Visit again /admin/structure/views/view/who_s_new and it should result into WSOD

Proposed resolution

Make our code work so that it doesn't result into WSOD.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lauriii created an issue. See original summary.

volkerk’s picture

Status: Active » Needs review
FileSize
615 bytes

Added watchdog in alter function.

lauriii’s picture

+++ b/claro.theme
@@ -450,6 +450,10 @@ function claro_form_view_edit_form_alter(&$form, FormStateInterface $form_state)
+    if (empty($dummy_dropbutton)) {

Maybe we could just simplify this to simple boolean comparison: if (!$dummy_dropbutton) {

volkerk’s picture

FileSize
609 bytes

Okay

Eli-T’s picture

Status: Needs review » Needs work

With respect to the patch in #4; whilst I'm normally keen on early returns, this feels a little odd in a function that modifies variables passed by reference, especially where we have already made changes to $form.

It is also possible that in the future, futher actions are required in the claro_form_view_edit_form_alter(), to be processed after the block that starts if (!empty($form['displays'])) { This would not be reached if we hit the if (!$dummy_dropbutton) early return condition and could lead to a subtle source of bugs.

Therefore I recommend that instead of

if (!$dummy_dropbutton) {
   return;
}

we have something more like

if ($dummy_dropbutton) {
    $child_keys = Element::children($dummy_dropbutton);
    $prefix_regex = '/(<.*class\s*= *["\']?)([^"\']*)(.*)/i';
    $child_count = 0;
.
.
.

}
volkerk’s picture

FileSize
3.11 KB

Use nesting instead of early return as Eli-T suggested.

Eli-T’s picture

Status: Needs work » Reviewed & tested by the community

This looks awesome now. I've tested with and without the patch and confirm that this fixes the issue, and the change requested in #5 has been implemented.

Therefore moving to RTBC.

  • lauriii committed 0b0359e on 8.x-1.x
    Issue #3060688 by volkerk, lauriii, Eli-T: WSOD on Views UI
    
lauriii’s picture

Status: Reviewed & tested by the community » Fixed

Looks good! Thank you! Committed and pushed!

Status: Fixed » Closed (fixed)

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