Problem/Motivation
Extremely bewildering and frustrating problem where, if I go to admin/structure/views/settings, change an option, and then click "Save configuration", I get the following error:
Error message
'skip_cache' is not a supported key.
...and then my changes don't save. I don't even know where to start investigating the possible cause because all the searches I've done so far offer no insight. This seems the closest - https://www.drupal.org/project/drupal/issues/2541074 - but there's nothing I can see about this particular skip_cache glitch. I've also checked admin/reports/dblog and there's nothing there either.
Steps to reproduce
- Go to admin/structure/views/settings
- Change an option, e.g. "Show the SQL query"
- Click "Save configuration"
You'll get the error above. It will look as if the change was saved, but if you navigate away from admin/structure/views/settings and then go back to it, you'll see whatever change you made got reverted. I'm on Drupal version 10.2.6 (Pantheon multidev, though I suspect the problem will also occur on our main site because I haven't made any changes to this multidev which should result in this error).
Has anyone else ever run into this? Any ideas what else I could check or change? I'm honestly not sure if this is an issue with how our site is set up (I can't think of anything offhand) or a bug within Views itself. I'm not a Drupal programmer so I'd prefer to resolve this without the use of custom modules if possible.
Comments
Comment #2
tqureshi commentedComment #3
lendudeDid you run updates? That setting was removed in #2541074: Get rid of using 'views.settings':skip_cache in ViewsData
Comment #4
tqureshi commentedIf you mean database updates, admin/reports/status shows them as already up to date and going to /update.php tells me there are no pending updates. Is there some other step I need to take?
Comment #5
mortona2k commentedI had the same problem on a site created 3 months ago. I think it was on 10.2 and updated to 10.3.
No pending updates. I'm not sure if they ran before or something else happened.
I fixed it with drush cedit. Edit views.settings and remove the skip_cache line.
This was causing an issue where if I tried to save a views plugin, it would redirect to a standalone preview page. I found this issue when I tried to adjust views settings and saw the message.
Comment #6
catchThe most likely way this could happen is if:
1. A site was originally installed on a version that had this setting, with config exported to the config/sync directory.
2. Site is updated to a version with #2541074: Get rid of using 'views.settings':skip_cache in ViewsData applied.
3. Database updates are run, but then after that, the config is not re-exported to the config/sync directory.
4. Later on, config is imported - this would re-introduce the 'skip_cache' key that was removed in the update.
#2628144: Ensure that ConfigImport is taking place against the same code base would prevent step #4, but doesn't help sites that have already got into this state.
Comment #7
quietone commentedFixes are made on on 11.x (our main development branch) first, and are then back ported as needed according to our policies.
Comment #8
attheshow commentedSame issue here on 10.3.6. I was able to fix it on my site by editing views.settings.yml and removing the line that said
skip_cache: falseand then re-running the configuration import.Comment #9
super_romeo commented#8 worked for me. D10.4
Comment #10
francismak commentedSame here, upgraded to 10.3. I think the removal of the skip_cache key was introduced since 10.2 in web/core/modules/views/views.post_update.php, function views_post_update_remove_skip_cache_setting.
Ref: https://git.drupalcode.org/project/drupal/-/commit/3f6c5710fc9d044bc34de...
I tried to simulate the case, but after skip_cache is cleared, there is nothing for config to export. Maybe that's why the config still exist in the system.
Of course, #8 resolve the issue.
1. Running drush, see the config
dev-www>drush config:get views.settings skip_cache
'views.settings:skip_cache': false
2. Running the code copied from views_post_update_remove_skip_cache_setting manually:
\Drupal::configFactory()
->getEditable('views.settings')
->clear('skip_cache')
->save(TRUE);
3. Clear cache and verify
dev-www>drush cr
[success] Cache rebuild complete.
dev-www>drush config:get views.settings skip_cache
'views.settings:skip_cache': null
4. Drush export
dev-www>drush cex
[notice] The active configuration is identical to the configuration in the export directory (../config/sync).
../config/sync
Comment #11
tregonia commentedEncountered this for the first time today. Went to the views settings and attempted to enable the default display to debug something.
#8 is the solution; a manual edit to the config resolved the issue.
Working on Drupal 11.2.4, the current tip of Drupal, it is wild that this config was able to live in the exported yml, and not get noticed till today.
Comment #12
thirstysix commentedSolution:
Open views.settings.yml
config/sync/views.settings.yml
Remove the line:
skip_cache:
or
skip_cache: null
Config Import: vendor/bin/drush cim
Clear caches: vendor/bin/drush cr
Config Export: vendor/bin/drush cex
Verify: vendor/bin/drush config:get views.settings
Done.