feat: rebuild product search engine immediately after adding a new product

This commit is contained in:
thekiwismarthome
2026-02-25 21:54:33 +13:00
parent 9bdaea0b1b
commit 11180db0e3
@@ -460,6 +460,9 @@ class ShoppingListStorage:
)
self._products[new_product.id] = new_product
await self._save_products()
# Rebuild search engine so the new product is immediately searchable
products_dict = {pid: p.to_dict() for pid, p in self._products.items()}
self._search_engine = ProductSearch(products_dict)
_LOGGER.debug("Added product: %s", new_product.name)
return new_product