fix(project-map): null-safe feature/inspection relations in tab tables
Features and Inspections tab tables read $feature->layer->name and $inspection->feature->name (and template/user) without null guards. When a referenced feature/layer was soft-deleted, the relation is null and rendering threw 'Attempt to read property name on null', returning HTTP 500 on every Livewire update — which also prevented the tabs from switching (the update that changes activeTab crashed during re-render). Made all chained relation reads null-safe with ?-> and '—' fallbacks. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -275,8 +275,8 @@
|
|||||||
@foreach($allFeatures as $feature)
|
@foreach($allFeatures as $feature)
|
||||||
<tr class="hover" wire:click="selectFeature({{ $feature->id }})">
|
<tr class="hover" wire:click="selectFeature({{ $feature->id }})">
|
||||||
<td>{{ $feature->name }}</td>
|
<td>{{ $feature->name }}</td>
|
||||||
<td>{{ $feature->layer->name }}</td>
|
<td>{{ $feature->layer?->name ?? '—' }}</td>
|
||||||
<td>{{ $feature->layer->phase->name }}</td>
|
<td>{{ $feature->layer?->phase?->name ?? '—' }}</td>
|
||||||
<td>{{ $feature->progress }}%</td>
|
<td>{{ $feature->progress }}%</td>
|
||||||
<td>{{ $feature->responsible ?? '-' }}</td>
|
<td>{{ $feature->responsible ?? '-' }}</td>
|
||||||
<td>{{ $feature->template?->name ?? '-' }}</td>
|
<td>{{ $feature->template?->name ?? '-' }}</td>
|
||||||
@@ -311,10 +311,10 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
@foreach($allInspections as $inspection)
|
@foreach($allInspections as $inspection)
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ $inspection->created_at->format('d/m/Y') }}</td>
|
<td>{{ $inspection->created_at?->format('d/m/Y') ?? '—' }}</td>
|
||||||
<td>{{ $inspection->feature->name }}</td>
|
<td>{{ $inspection->feature?->name ?? '—' }}</td>
|
||||||
<td>{{ $inspection->template->name }}</td>
|
<td>{{ $inspection->template?->name ?? '—' }}</td>
|
||||||
<td>{{ $inspection->user->name }}</td>
|
<td>{{ $inspection->user?->name ?? '—' }}</td>
|
||||||
<td class="justify-end">
|
<td class="justify-end">
|
||||||
<button class="btn btn-xs btn-outline btn-info"><x-heroicon-o-eye class="w-3.5 h-3.5" /></button>
|
<button class="btn btn-xs btn-outline btn-info"><x-heroicon-o-eye class="w-3.5 h-3.5" /></button>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user