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:
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
|
||||
{
|
||||
$currentRecipeId = $this->record->recipes_id;
|
||||
|
||||
return $table
|
||||
->query(
|
||||
Recipe::query()
|
||||
->query(fn () => Recipe::query()
|
||||
->where('product_id', $this->record->id)
|
||||
->with('spices')
|
||||
->orderByDesc('version')
|
||||
@@ -59,7 +56,7 @@ class RecipeHistory extends Page implements HasTable
|
||||
->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) =>
|
||||
|
||||
Reference in new issue
Block a user