Problem/Motivation

If set "Custom" in select in page "Caching options", then after saving the view the "Never cache" option is set to select. Seems the problem is only output, because debug shows custom cache sets and works.

Steps to repeat:
1. Create the view
2. Select "Time-based" in Caching
3. Click "Apply"
4. Select "Custom" in Caching options
5. Write quantity seconds in textfield "Seconds" 
6. Click "Apply"
7. Save the view
8. Open page "Caching options" in the view

Expected Results:
In select will set "Custom" and will be visible textfield "Seconds"

Actual Results:
In select will set "Never cache" and won't be visible textfield "Seconds".

Proposed resolution

I think the problem is option Custom "knows" about textfield Seconds, and textfield becomes visible at a select Custom. However, textfield don't "knows" about option Custom and the option Never cache sets in select at output form Caching options again after saving view. Need somehow link textfield and option Custom if selected Custom.

Comments

aleanna created an issue. See original summary.

asya_asina’s picture

This patch links textfield and option Custom. Also added cleaning textfield if selected a other option in order that option Custom was not set default.

Aanal.addweb’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new164.01 KB
new166.42 KB

@aleanna, Thanks for describing the steps. I followed the same steps to catch the issue you mentioned above. Your patch works well for me & I attached the screenshots for the same.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

Thanks for reporting this bug. And describing the steps to reproduce it so other can test it.

In order to commit a bug fix we need an automated to test to prove that we've fixed the bug and ensure that we don't break it again in the future. For more information about writing tests in Drupal 8 see the following links:

  1. https://www.drupal.org/docs/8/testing
  2. https://api.drupal.org/api/drupal/core%21core.api.php/group/testing/8.7.x

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

amber himes matz’s picture

Issue tags: +Bug Smash Initiative

I think it would be worth checking if the latest patch in #3233105: Time-based custom caching is broken since configuration expects an integer. fixes the issue described here. If so, we could close this one as a duplicate.

If not, this issue needs to be re-verified, if valid, then the latest patch re-rolled, and then it needs tests.

anchal_gupta’s picture

StatusFileSize
new2.27 KB

Rerolled patch against 9.5x. Please review it

smustgrave’s picture

Status: Needs work » Closed (duplicate)

Brought up in the bugsmash channel it was agreed upon this is a duplicate of https://www.drupal.org/project/drupal/issues/3233105

I'll move over relevant credit to that issue now.