fix: resolve server-entry grid card resource freeze#2441
Conversation
📝 WalkthroughWalkthroughThe ChangesServer entry reactive refresh fix
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
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
resources/views/livewire/columns/server-entry-column.blade.php (1)
7-7: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider removing the now-dead
placeholder()method.With
lazy => trueremoved,ServerEntry::placeholder()(lines 22–25 inServerEntry.php) is no longer invoked — Livewire only callsplaceholder()for lazy-loaded components. If no other code path uses lazy loading for this component, both the method and itslivewire.server-entry-placeholderview 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
📒 Files selected for processing (3)
app/Livewire/ServerEntry.phpresources/views/livewire/columns/server-entry-column.blade.phpresources/views/livewire/server-entry.blade.php
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
ListServerstable polling and the nested lazy-loadedserver-entrycomponent. Every 15 seconds, the parent table would trigger a refresh. Because the nested component was set tolazy => true, the parent refresh would reset the child component back to its empty placeholder state, interrupting its own internalwire: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
lazy => trueflag from the@livewiredirective inserver-entry-column.blade.php.wire:poll.15sfromserver-entry.blade.php(as the parent table already polls every 15s).Livewire\Attributes\Reactiveattribute to thepublic Server $server;property inApp\Livewire\ServerEntry.phpto ensure the child component reacts to the$serverprop updates driven by the parent component's poll.How to Test