I have a problem with my 2 level dependent dropdown.
Dropdown at the page: https://i.ibb.co/d4PBYFcz/5904325373724837675.jpg
After I enter data into the selectors, I am taken to another page, but after returning to the previous page, my component appears to be broken
The problem is that when I go back from recipes.blade.php page to index.blade.php my component stops working normally (in place of dishes selector I see just an empty white field, there is nothing there), in the other selectors remain the previously selected data. By design, if I return to the index.blade.php page, the component should be clean. Maybe someone has encountered such a problem?
Dropdown after problem: https://i.ibb.co/XZYS2S6p/5904325373724837678.jpg
view:
Filter.php:
class Filter extends Component
{
public $dishCategories;
public $dishes;
public $dishCategory;
public $dish;
public $cuisines;
public $menus;
public function mount()
{
$this->dishCategories = DishCategory::all();
$this->dishes = collect();
$this->cuisines = Cuisine::get();
$this->menus = Menu::get();
}
public function render()
{
return view('livewire.filter');
}
public function updatedDishCategory($value)
{
return $this->dishes = Recipe::where('dish_category_id', $value)->get();
}
}
I tried different ways to create that logic but unfortunately they had exactly same problem.