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(logs): wrap viewer in a root element for parent re-renders

Andras Bacsai393dcbb6cd19
diff --git a/resources/views/livewire/project/shared/get-logs.blade.php b/resources/views/livewire/project/shared/get-logs.blade.php
index e05ef34eaa..7b000c8a78 100644
--- a/resources/views/livewire/project/shared/get-logs.blade.php
+++ b/resources/views/livewire/project/shared/get-logs.blade.php
@@ -1,3 +1,4 @@
+<div>
@if (! $canReadLogs)
<x-callout type="info" title="Hidden (only admins can view)">
Container logs can contain secrets.
@@ -315,3 +316,4 @@
</div>
</div>
@endif
+</div>
diff --git a/tests/Feature/Authorization/TaskAndLogOutputVisibilityTest.php b/tests/Feature/Authorization/TaskAndLogOutputVisibilityTest.php
index eb51d9c4b3..891711458b 100644
--- a/tests/Feature/Authorization/TaskAndLogOutputVisibilityTest.php
+++ b/tests/Feature/Authorization/TaskAndLogOutputVisibilityTest.php
@@ -136,3 +136,16 @@ it('shows task commands and task output to an owner in the ui', function () {
Livewire::test(GetLogs::class, ['server' => $this->server, 'resource' => $this->application, 'container' => 'app-container'])
->assertDontSee('Hidden (only admins can view)');
});
+
+it('renders logs inside one root element so the parent can re-render it', function (string $role) {
+ $this->actingAs($role === 'owner' ? $this->owner : $this->member);
+ session(['currentTeam' => $this->team]);
+
+ $html = Livewire::test(GetLogs::class, ['server' => $this->server, 'resource' => $this->application, 'container' => 'app-container'])
+ ->html();
+
+ // Livewire reuses the first tag name as the placeholder for kept children; a leading comment gives an empty tag.
+ preg_match('/<([a-zA-Z0-9\-]*)/', $html, $matches);
+
+ expect($matches[1])->toBe('div');
+})->with(['owner', 'member']);