Fix 404 on recipe history page
Deploy / deploy (push) Successful in 14s

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 <noreply@anthropic.com>
This commit is contained in:
Malek TellissiandClaude Sonnet 4.6 committed 2026-09-12 18:30:07 +02:00
1 parent 656b105cb9
commit dd710cb1c0
1 file changed
+2 -5
@@ -45,11 +45,8 @@ class RecipeHistory extends Page implements HasTable
public function table(Table $table): Table public function table(Table $table): Table
{ {
$currentRecipeId = $this->record->recipes_id;
return $table return $table
->query( ->query(fn () => Recipe::query()
Recipe::query()
->where('product_id', $this->record->id) ->where('product_id', $this->record->id)
->with('spices') ->with('spices')
->orderByDesc('version') ->orderByDesc('version')
@@ -59,7 +56,7 @@ class RecipeHistory extends Page implements HasTable
->label('Version') ->label('Version')
->formatStateUsing(fn ($state) => 'v' . $state) ->formatStateUsing(fn ($state) => 'v' . $state)
->badge() ->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') TextColumn::make('spices_summary')
->label('Zutaten') ->label('Zutaten')
->state(fn (Recipe $recipe) => ->state(fn (Recipe $recipe) =>