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:
2026-06-17 11:52:56 +02:00
parent de68638d7c
commit 24976e28da
@@ -275,8 +275,8 @@
@foreach($allFeatures as $feature)
<tr class="hover" wire:click="selectFeature({{ $feature->id }})">
<td>{{ $feature->name }}</td>
<td>{{ $feature->layer->name }}</td>
<td>{{ $feature->layer->phase->name }}</td>
<td>{{ $feature->layer?->name ?? '—' }}</td>
<td>{{ $feature->layer?->phase?->name ?? '—' }}</td>
<td>{{ $feature->progress }}%</td>
<td>{{ $feature->responsible ?? '-' }}</td>
<td>{{ $feature->template?->name ?? '-' }}</td>
@@ -311,10 +311,10 @@
<tbody>
@foreach($allInspections as $inspection)
<tr>
<td>{{ $inspection->created_at->format('d/m/Y') }}</td>
<td>{{ $inspection->feature->name }}</td>
<td>{{ $inspection->template->name }}</td>
<td>{{ $inspection->user->name }}</td>
<td>{{ $inspection->created_at?->format('d/m/Y') ?? '—' }}</td>
<td>{{ $inspection->feature?->name ?? '—' }}</td>
<td>{{ $inspection->template?->name ?? '—' }}</td>
<td>{{ $inspection->user?->name ?? '—' }}</td>
<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>
</td>