Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix(analytics): label zero response status in traffic breakdowns

Andras Bacsaic4f96a7185b1
diff --git a/resources/views/livewire/traffic/_breakdown-section.blade.php b/resources/views/livewire/traffic/_breakdown-section.blade.php
index d854f4e924..e6b1e9be4f 100644
--- a/resources/views/livewire/traffic/_breakdown-section.blade.php
+++ b/resources/views/livewire/traffic/_breakdown-section.blade.php
@@ -31,6 +31,7 @@
: match ($dimension) {
'device' => deviceLabel($value),
'referer' => $host ?? 'Direct / none',
+ 'status' => $value === '0' ? 'No response status (0)' : ($value !== '' ? $value : 'Unknown'),
default => $value !== '' ? $value : 'Unknown',
};
$requests = (int) ($row['requests'] ?? 0);
diff --git a/tests/Feature/TrafficAnalytics/AnalyticsFormattingTest.php b/tests/Feature/TrafficAnalytics/AnalyticsFormattingTest.php
index 2401622624..54fd736d6f 100644
--- a/tests/Feature/TrafficAnalytics/AnalyticsFormattingTest.php
+++ b/tests/Feature/TrafficAnalytics/AnalyticsFormattingTest.php
@@ -55,3 +55,21 @@ it('renders ampersands in breakdown empty-state descriptions', function () {
->toContain('No ai agents & bots data for the selected range.')
->not->toContain('No ai agents & bots data for the selected range.');
});
+
+it('distinguishes a missing response status from numeric values in other dimensions', function (string $dimension, mixed $value, string $display) {
+ $html = view('livewire.traffic._breakdown-section', [
+ 'dimension' => $dimension,
+ 'label' => 'Breakdown',
+ 'rows' => [['value' => $value, 'requests' => 2, 'bytesOut' => 0]],
+ ])->render();
+
+ expect($html)->toContain('title="'.$display.'"')
+ ->toContain('title="2 requests"');
+})->with([
+ 'integer zero status' => ['status', 0, 'No response status (0)'],
+ 'string zero status' => ['status', '0', 'No response status (0)'],
+ 'valid status' => ['status', '200', '200'],
+ 'missing status' => ['status', '', 'Unknown'],
+ 'overflow status' => ['status', '__other__', 'Other'],
+ 'zero in another dimension' => ['path', '0', '0'],
+]);