Skip to content

fix: resolve server-entry grid card resource freeze#2441

Open
apple050620312 wants to merge 1 commit into
pelican-dev:mainfrom
apple050620312:fix/issue-2427
Open

fix: resolve server-entry grid card resource freeze#2441
apple050620312 wants to merge 1 commit into
pelican-dev:mainfrom
apple050620312:fix/issue-2427

Conversation

@apple050620312

Copy link
Copy Markdown
Contributor

Closes #2427

What does this PR do?

This PR fixes an issue where the Server CPU, RAM, and Uptime statistics freeze on their initially loaded values when the dashboard is viewed in "Grid" layout (Cards).

The root cause was a conflict between the Livewire ListServers table polling and the nested lazy-loaded server-entry component. Every 15 seconds, the parent table would trigger a refresh. Because the nested component was set to lazy => true, the parent refresh would reset the child component back to its empty placeholder state, interrupting its own internal wire:poll.15s. Consequently, the component never fully advanced past its original mount state.

This fix properly resolves the reactivity conflict by utilizing Livewire v3's #[Reactive] attribute to push parent data down to the children, rather than relying on the children to independently lazy load and poll.

Implementation Details

  • Removed the lazy => true flag from the @livewire directive in server-entry-column.blade.php.
  • Removed the redundant wire:poll.15s from server-entry.blade.php (as the parent table already polls every 15s).
  • Added the Livewire\Attributes\Reactive attribute to the public Server $server; property in App\Livewire\ServerEntry.php to ensure the child component reacts to the $server prop updates driven by the parent component's poll.

How to Test

  1. Access the Client Panel Dashboard.
  2. Ensure your dashboard view layout is set to Grid.
  3. Observe a running server's CPU, Memory, or Uptime progress bars.
  4. Verify that the stats automatically refresh every 15 seconds without remaining permanently frozen.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The ServerEntry Livewire component's Server property is marked with the #[Reactive] attribute. The server-entry-column.blade.php template no longer passes the lazy option when invoking the component, and server-entry.blade.php removes its own wire:poll.15s attribute.

Changes

Server entry reactive refresh fix

Layer / File(s) Summary
Reactive property on ServerEntry
app/Livewire/ServerEntry.php
Adds #[Reactive] attribute to the public Server $server property so the component reflects updates from its parent.
Remove lazy loading and independent polling
resources/views/livewire/columns/server-entry-column.blade.php, resources/views/livewire/server-entry.blade.php
Removes 'lazy' => true from the @livewire('server-entry', ...) call and removes wire:poll.15s from the component's root div, so the child no longer re-mounts blank or polls independently, relying instead on the parent's poll and the reactive property.

Sequence Diagram(s)

sequenceDiagram
  participant ListServers
  participant ServerEntryColumn
  participant ServerEntry

  ListServers->>ServerEntryColumn: poll('15s')
  ServerEntryColumn->>ServerEntry: `@livewire`('server-entry', ['server' => $server])
  ServerEntry->>ServerEntry: Reactive Server property updates
  ServerEntry-->>ServerEntryColumn: re-render with fresh CPU/RAM/uptime
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: fixing frozen server-entry cards in the grid layout.
Description check ✅ Passed The description is directly related to the Livewire reactivity fix for frozen grid card stats.
Linked Issues check ✅ Passed The changes satisfy #2427 by removing lazy/polling conflicts and making the server prop reactive.
Out of Scope Changes check ✅ Passed No unrelated code changes are evident beyond the issue-specific Livewire grid-card fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
resources/views/livewire/columns/server-entry-column.blade.php (1)

7-7: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider removing the now-dead placeholder() method.

With lazy => true removed, ServerEntry::placeholder() (lines 22–25 in ServerEntry.php) is no longer invoked — Livewire only calls placeholder() for lazy-loaded components. If no other code path uses lazy loading for this component, both the method and its livewire.server-entry-placeholder view are dead code.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@resources/views/livewire/columns/server-entry-column.blade.php` at line 7,
The ServerEntry component is no longer lazy-loaded, so its placeholder path is
dead code. Remove the unused placeholder() method from ServerEntry and delete
the livewire.server-entry-placeholder view if nothing else references it, using
ServerEntry and placeholder() as the key symbols to locate the cleanup.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@resources/views/livewire/columns/server-entry-column.blade.php`:
- Line 7: The ServerEntry component is no longer lazy-loaded, so its placeholder
path is dead code. Remove the unused placeholder() method from ServerEntry and
delete the livewire.server-entry-placeholder view if nothing else references it,
using ServerEntry and placeholder() as the key symbols to locate the cleanup.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 925dff64-80ea-4804-a243-71fa3d7320cf

📥 Commits

Reviewing files that changed from the base of the PR and between b8bbf29 and db6ea84.

📒 Files selected for processing (3)
  • app/Livewire/ServerEntry.php
  • resources/views/livewire/columns/server-entry-column.blade.php
  • resources/views/livewire/server-entry.blade.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dashboard grid/card layout: server resource stats (CPU/RAM/uptime) freeze and never update

1 participant