From 24976e28da2d06f41e65881c7739723ff1733731 Mon Sep 17 00:00:00 2001 From: javier Date: Wed, 17 Jun 2026 11:52:56 +0200 Subject: [PATCH] fix(project-map): null-safe feature/inspection relations in tab tables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- .../views/livewire/projects/project-map.blade.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/views/livewire/projects/project-map.blade.php b/resources/views/livewire/projects/project-map.blade.php index 6ef5f3d..458c229 100644 --- a/resources/views/livewire/projects/project-map.blade.php +++ b/resources/views/livewire/projects/project-map.blade.php @@ -275,8 +275,8 @@ @foreach($allFeatures as $feature) {{ $feature->name }} - {{ $feature->layer->name }} - {{ $feature->layer->phase->name }} + {{ $feature->layer?->name ?? '—' }} + {{ $feature->layer?->phase?->name ?? '—' }} {{ $feature->progress }}% {{ $feature->responsible ?? '-' }} {{ $feature->template?->name ?? '-' }} @@ -311,10 +311,10 @@ @foreach($allInspections as $inspection) - {{ $inspection->created_at->format('d/m/Y') }} - {{ $inspection->feature->name }} - {{ $inspection->template->name }} - {{ $inspection->user->name }} + {{ $inspection->created_at?->format('d/m/Y') ?? '—' }} + {{ $inspection->feature?->name ?? '—' }} + {{ $inspection->template?->name ?? '—' }} + {{ $inspection->user?->name ?? '—' }}