From dd710cb1c07e8314ed70668242af0a360cf808e6 Mon Sep 17 00:00:00 2001 From: Malek Tellissi Date: Sat, 12 Sep 2026 18:30:07 +0200 Subject: [PATCH] Fix 404 on recipe history page bootedInteractsWithTable() calls table() before mount() sets $this->record. Accessing $this->record eagerly causes a TypeError on the uninitialized typed property, which Filament/Livewire converts to a 404. Deferred all $this->record accesses into closures so they only execute at render time (after mount() has run). Co-Authored-By: Claude Sonnet 4.6 --- .../ProductResource/Pages/RecipeHistory.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/app/Filament/User/Resources/ProductResource/Pages/RecipeHistory.php b/app/Filament/User/Resources/ProductResource/Pages/RecipeHistory.php index b41604d..00ab36c 100644 --- a/app/Filament/User/Resources/ProductResource/Pages/RecipeHistory.php +++ b/app/Filament/User/Resources/ProductResource/Pages/RecipeHistory.php @@ -45,21 +45,18 @@ class RecipeHistory extends Page implements HasTable public function table(Table $table): Table { - $currentRecipeId = $this->record->recipes_id; - return $table - ->query( - Recipe::query() - ->where('product_id', $this->record->id) - ->with('spices') - ->orderByDesc('version') + ->query(fn () => Recipe::query() + ->where('product_id', $this->record->id) + ->with('spices') + ->orderByDesc('version') ) ->columns([ TextColumn::make('version') ->label('Version') ->formatStateUsing(fn ($state) => 'v' . $state) ->badge() - ->color(fn (Recipe $recipe) => $recipe->id === $currentRecipeId ? 'success' : 'gray'), + ->color(fn (Recipe $recipe) => $recipe->id === $this->record->recipes_id ? 'success' : 'gray'), TextColumn::make('spices_summary') ->label('Zutaten') ->state(fn (Recipe $recipe) =>