Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Chi created an issue. See original summary.

rakesh.gectcr’s picture

Assigned: Unassigned » rakesh.gectcr
dawehner’s picture

Chi’s picture

@dawehner, the bugs are different from each other but I admit they may have the same primary reason.

g089h515r806’s picture

I have the same problem. it seems that block form has been cached, and i co not know how to disable cache for a specific block.
https://www.drupal.org/node/2603244

At last I solve this issue by using jquery:

$.getUrlParam = function(name){
  var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
  var r = window.location.search.substr(1).match(reg);
  if (r!=null) return decodeURI(r[2]); return null;
}
	var title = $.getUrlParam('title');
	if(title){
	  $('#views-exposed-form-addressbooks-page-2 .form-text').val(title);
	}
legolasbo’s picture

Assigned: rakesh.gectcr » legolasbo

Bug reproduced + fixed locally.

Currently extending test coverage.

legolasbo’s picture

Status: Active » Needs review
FileSize
990 bytes

Let's see what testbot has to say about it so far.

Still working on new tests.

legolasbo’s picture

Found and fixed a null reference exception in previous patch.

The last submitted patch, 9: exposed_form_does_not-2596649-9.patch, failed testing.

legolasbo’s picture

Moved cache context generation to ExposedFormPluginBase::getCacheContexts() which seems more sensible.

legolasbo’s picture

Still new to this cacheContexts thing. The block should expose them, not it's render array.

legolasbo’s picture

legolasbo’s picture

While working on this I found out that the filters could provide more specific cache contexts. See #2605038: Views Exposed Filters should provide more specific cache contexts. for more info.

The last submitted patch, 14: exposed_form_does_not-2596649-14-tests-only.patch, failed testing.

dawehner’s picture

Just a small nitpick ...

+++ b/core/modules/views/src/Plugin/Block/ViewsExposedFilterBlock.php
@@ -19,10 +20,19 @@
 
   /**
+   * @inheritedDoc
+   */
+  public function getCacheContexts() {

nitpick: it should be {@inheritdoc}

rakesh.gectcr’s picture

@dawehner

I update your comment

rakesh.gectcr’s picture

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Thank you!

The last submitted patch, 9: exposed_form_does_not-2596649-9.patch, failed testing.

The last submitted patch, 14: exposed_form_does_not-2596649-14-tests-only.patch, failed testing.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.1.x and cherry-picked to 8.0.x. Thanks!

  • catch committed e693ef3 on
    Issue #2596649 by legolasbo, rakesh.gectcr: Exposed form does not save...

  • catch committed 478b6b7 on
    Issue #2596649 by legolasbo, rakesh.gectcr: Exposed form does not save...
Wim Leers’s picture

Issue tags: +D8 cacheability

Status: Fixed » Closed (fixed)

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