Skip to content

Commit

Permalink
Update entry stache indexes on tree save
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksleight committed Feb 1, 2024
1 parent bffeedd commit a5b7e90
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Stache/Repositories/CollectionTreeRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace Statamic\Stache\Repositories;

use Statamic\Contracts\Structures\CollectionTree as TreeContract;
use Statamic\Contracts\Structures\Tree;
use Statamic\Facades\Stache as StacheFacade;
use Statamic\Stache\Stache;
use Statamic\Structures\CollectionTree;

Expand All @@ -20,4 +22,16 @@ public static function bindings()
TreeContract::class => CollectionTree::class,
];
}

public function save(Tree $tree)
{
$result = parent::save($tree);

StacheFacade::store('entries')
->store($tree->collection()->handle())
->resolveIndexes()
->each->update();

return $result;
}
}

0 comments on commit a5b7e90

Please sign in to comment.