From 4cf1c2f90bbb5f29bbd32983c103065f670e2acb Mon Sep 17 00:00:00 2001 From: Krzysiej Date: Thu, 15 Jan 2026 08:47:17 +0100 Subject: [PATCH] Clear list cache after clicking on a star item. --- src/Controller/StarController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Controller/StarController.php b/src/Controller/StarController.php index 7b743ba..c56d797 100644 --- a/src/Controller/StarController.php +++ b/src/Controller/StarController.php @@ -12,6 +12,10 @@ final class StarController extends BaseController #[Route('/star/{productId<\d+>}', name: 'app_star')] public function __invoke(int $productId, Request $request): Response { + if($this->cache->getItem('list_all')->isHit()) { + $this->cache->deleteItems(['list_all', 'list_promos', 'list_new', 'list_discontinued']); + } + Product::find($productId)->toggleStarred()->save(); return $this->redirect($request->headers->get('referer')); } -- 2.52.0