When creating a new index, you have to clear all caches before views picks up the new index in the "Add new view" page.

Comments

borisson_’s picture

Issue should be resolved with http://cgit.drupalcode.org/sandbox-daeron-2091893/commit/?id=78e48a1,

There's still a line in that invalidates the 'extension:views' cache, that should get removed if https://www.drupal.org/node/2370365 gets fixed.

drunken monkey’s picture

Project: Search API (8.x) » Search API
Version: » 8.x-1.x-dev
Component: Framework » Views integration
swentel’s picture

Had it again - so we're still not clearing something - probably some views data

swentel’s picture

Title: Creating an index requires a cache-clear before the index can be used as a view source. » Creating or deleting an index requires a cache-clear before the index can be used as a view source.
Status: Active » Needs review
StatusFileSize
new1.61 KB
swentel’s picture

StatusFileSize
new1.82 KB

better patch - weirdly enough adding is fine with just one flush.

swentel’s picture

StatusFileSize
new1.89 KB

And now final

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

Works and the code looks good.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 6: 2370223-6.patch, failed testing.

borisson_’s picture

Status: Needs work » Reviewed & tested by the community

Testbot--

drunken monkey’s picture

+++ b/src/Form/IndexDeleteConfirmForm.php
@@ -44,6 +45,12 @@ class IndexDeleteConfirmForm extends EntityConfirmFormBase {
+    // Remove this line when https://www.drupal.org/node/2370365 gets fixed.
+    Cache::invalidateTags(array('extension:views'));
+    \Drupal::cache('discovery')->delete('views:wizard');

Do you mean "this line" or "these lines"? I.e., should the \Drupal::cache('discovery')… line also go once that issue gets fixed?

In any case, seems to make sense (more or less), thanks for posting!

borisson_’s picture

This line, it's only Cache::invalidateTags(array('extension:views')); that is linked in that other issue/

drunken monkey’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new2.15 KB

OK, thanks. I was just asking because the comment was also there in the other form, where he removed that line.

Apart from that, though, I think this should rather go into the index entity class, since it otherwise would only work when doing changes via the UI? Patch attached, please test whether this still fixes the issue for you!

(Also, Views::viewsData()->clear() looks nicer than the explicit use of the cache tag, even though it seems to be the same. What, on the other hand, views_invalidate_cache() does is a bit beyond me.)

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

Looks great.

  • drunken monkey committed f0fb463 on 8.x-1.x authored by swentel
    Issue #2370223 by swentel, drunken monkey: Fixed Views data invalidation...
drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

Good to hear, thanks for reviewing!
Committed.
Thanks again to both of you!

Status: Fixed » Closed (fixed)

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