Livewire v3 Performance: Payloads &amp; Computed Properties | Mohamed Said       [Skip to content](#main)  [ ![](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png) Mohamed SaidLaravel Backend Engineer ](https://www.msaied.com/public) - [Home](https://www.msaied.com/public)
- [Projects](https://www.msaied.com/public/projects)
- [Articles](https://www.msaied.com/public/articles)
- [Certificates](https://www.msaied.com/public/certificates)
- [About](https://www.msaied.com/public#about)

           [  Contact](https://www.msaied.com/public#contact) Menu 

Menu
----

Close 

 - [HomeStart here](https://www.msaied.com/public)
- [ProjectsCase studies](https://www.msaied.com/public/projects)
- [ArticlesEngineering notes](https://www.msaied.com/public/articles)
- [CertificatesCredentials](https://www.msaied.com/public/certificates)
- [AboutHow I work](https://www.msaied.com/public#about)
- [ContactGet in touch](https://www.msaied.com/public#contact)

  [Start a conversation](https://www.msaied.com/public#contact) [WhatsApp](https://wa.me/201094619204) [Email](mailto:hello@msaied.com) 

 1. [Home](https://www.msaied.com/public)
2. /
3. [Articles](https://www.msaied.com/public/articles)
4. /
5. Livewire v3 Performance: Lazy Hydration, Computed Properties, and Minimising Wire Payloads

 Livewire v3 Performance: Lazy Hydration, Computed Properties, and Minimising Wire Payloads
===========================================================================================

 Practical techniques for keeping Livewire v3 components fast: lazy hydration, memoised computed properties, targeted dirty-tracking, and trimming the JSON payload that travels on every request.

 ![](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp) [Mohamed Said](https://www.msaied.com/public#person) Published 16 Jul 2026 · Updated 16 Jul 2026 · 4 min read

ShareCopy linkCopied

 ![Livewire v3 Performance: Lazy Hydration, Computed Properties, and Minimising Wire Payloads](https://cdn.msaied.com/431/5931d6ca41b721bc1cd98ccc4ce063c7.png) 

  On this page +1. [Why Livewire Payloads Balloon](#why-livewire-payloads-balloon)
2. [Computed Properties: Derive, Don't Store](#computed-properties-derive-dont-store)
3. [Persisting Computed Values Across Requests](#persisting-computed-values-across-requests)
4. [Lazy Hydration for Below-the-Fold Components](#lazy-hydration-for-below-the-fold-components)
5. [Targeted Dirty-Tracking with #\[Locked\] and wire:model.live](#targeted-dirty-tracking-with-codelockedcode-and-codewiremodellivecode)
6. [Trimming the Payload: Avoid Public Eloquent Models](#trimming-the-payload-avoid-public-eloquent-models)
7. [Takeaways](#takeaways)

 Why Livewire Payloads Balloon
-----------------------------

Every Livewire network round-trip serialises your component's public state into JSON, ships it to the server, re-hydrates the component, runs the action, then returns a diff. The more public properties you expose — and the larger their values — the heavier that payload becomes. On a component with a paginated Eloquent collection stored as a public property, you can easily hit tens of kilobytes per interaction.

The fix is not to abandon Livewire; it is to be deliberate about *what* lives in public state versus what is derived on demand.

Computed Properties: Derive, Don't Store
----------------------------------------

The single biggest payload win is replacing stored query results with `#[Computed]` properties. Livewire v3 memoises them for the lifetime of a single request, so multiple template references cost one query.

```php
use Livewire\Attributes\Computed;

class UserTable extends Component
{
    public string $search = '';
    public int $perPage = 25;

    #[Computed]
    public function users(): LengthAwarePaginator
    {
        return User::query()
            ->when($this->search, fn ($q) => $q->where('name', 'like', "%{$this->search}%"))
            ->paginate($this->perPage);
    }

    public function render(): View
    {
        return view('livewire.user-table');
    }
}

```

The `$users` paginator never touches the wire payload. Only `$search` (a short string) and `$perPage` (an integer) are serialised. The query runs fresh on each hydration — which is exactly what you want for paginated, filterable data.

### Persisting Computed Values Across Requests

For expensive aggregates that do not change on every interaction, add `persist: true`:

```php
#[Computed(persist: true)]
public function roleSummary(): array
{
    return Role::withCount('users')->pluck('users_count', 'name')->all();
}

```

Livewire caches the return value in the session between requests. Use this sparingly — stale data is a real risk — and pair it with an explicit `unset($this->roleSummary)` call inside any action that mutates roles.

Lazy Hydration for Below-the-Fold Components
--------------------------------------------

Nesting many Livewire components on a single page multiplies initial hydration cost. The `#[Lazy]` attribute defers a component's first render until the browser requests it:

```php
use Livewire\Attributes\Lazy;

#[Lazy]
class RecentActivityFeed extends Component
{
    public function placeholder(): View
    {
        return view('livewire.placeholders.activity-skeleton');
    }

    public function render(): View
    {
        return view('livewire.recent-activity-feed');
    }
}

```

The parent page renders instantly; the browser fires a subsequent request for each lazy component. This trades one heavy synchronous render for several lighter async ones, which is almost always the right trade-off for dashboards.

Targeted Dirty-Tracking with `#[Locked]` and `wire:model.live`
--------------------------------------------------------------

Avoid `wire:model.live` on every input. It fires a network request on every keystroke. Reserve it for fields where immediate server feedback is genuinely needed (e.g., async validation). Use `wire:model` (deferred, syncs on next action) everywhere else.

For properties that should never be mutated from the client — IDs, tenant context, permission flags — add `#[Locked]`:

```php
#[Locked]
public int $tenantId;

```

Livewire will throw a `CorruptComponentPayloadException` if the client attempts to overwrite it, preventing a class of mass-assignment-style vulnerabilities.

Trimming the Payload: Avoid Public Eloquent Models
--------------------------------------------------

Storing an entire Eloquent model as a public property serialises every attribute, including ones your template never reads. Prefer storing only the identifier and re-fetching via a computed property:

```php
// Bad — full model in wire payload
public User $user;

// Good — only the ID travels over the wire
public int $userId;

#[Computed]
public function user(): User
{
    return User::findOrFail($this->userId);
}

```

For deeply nested forms, consider a DTO backed by Livewire's `#[Validate]` attribute rather than a raw array, so only the fields you declare are serialised.

Takeaways
---------

- Replace public query results with `#[Computed]` properties — they are memoised per request and never serialised.
- Use `persist: true` on expensive, rarely-changing aggregates; invalidate explicitly.
- Apply `#[Lazy]` to below-the-fold components to defer hydration cost.
- Prefer `wire:model` (deferred) over `wire:model.live` unless real-time server feedback is required.
- Mark immutable server-side properties with `#[Locked]` to prevent client tampering.
- Store only scalar identifiers in public state; re-hydrate full models via computed properties.

- [livewire](https://www.msaied.com/public/articles?search=livewire)
- [laravel](https://www.msaied.com/public/articles?search=laravel)
- [performance](https://www.msaied.com/public/articles?search=performance)
- [frontend](https://www.msaied.com/public/articles?search=frontend)

 Frequently asked questions 
---------------------------

  Does using #\[Computed\] mean the query runs on every single request, even when the data hasn't changed?Yes, by default a computed property re-executes its method on every hydration cycle. That is intentional — it keeps the wire payload small and the data fresh. If the query is expensive and the data is stable, add persist: true to cache the result in the session across requests, and call unset($this-&gt;propertyName) in any action that invalidates it.

   When should I use a nested Livewire component versus a Blade include for performance?Use a nested Livewire component only when that section needs its own independent interactivity or state. A Blade include has zero wire overhead. Unnecessary nesting multiplies hydration cost; pair any nested component with #\[Lazy\] if it is not needed on initial paint.

   ![Mohamed Said](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp)About the author
----------------

[Mohamed Said](https://www.msaied.com/public#person)Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

[About](https://www.msaied.com/public#about) [GitHub ↗](https://github.com/EG-Mohamed) [LinkedIn ↗](https://www.linkedin.com/in/msaiedm/) [WhatsApp ↗](https://wa.me/201094619204) [Email Address ↗](mailto:hello@msaied.com) [My CV ↗](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)  

   [Previous articleFilament v5 Preview: Schema Unification, Performance Shifts, and How to Prepare](https://www.msaied.com/public/articles/filament-v5-preview-schema-unification-performance-shifts-and-how-to-prepare-1) [Next articleVocalizer: Run Local Text-to-Speech in PHP with No API Calls](https://www.msaied.com/public/articles/vocalizer-run-local-text-to-speech-in-php-with-no-api-calls)  

   On this page
-------------

1. [Why Livewire Payloads Balloon](#why-livewire-payloads-balloon)
2. [Computed Properties: Derive, Don't Store](#computed-properties-derive-dont-store)
3. [Persisting Computed Values Across Requests](#persisting-computed-values-across-requests)
4. [Lazy Hydration for Below-the-Fold Components](#lazy-hydration-for-below-the-fold-components)
5. [Targeted Dirty-Tracking with #\[Locked\] and wire:model.live](#targeted-dirty-tracking-with-codelockedcode-and-codewiremodellivecode)
6. [Trimming the Payload: Avoid Public Eloquent Models](#trimming-the-payload-avoid-public-eloquent-models)
7. [Takeaways](#takeaways)

 ###  Have a technical challenge?

 Tell me what you’re building. I reply within two working days.

[Start a conversation](https://www.msaied.com/public#contact) 

   Related articles
-----------------

 [ ![](https://cdn.msaied.com/740/cce86edc21eddcbdd2f2454fadaf9c70.png)  · 3 min read### The Pipeline Pattern in Laravel: Custom Pipelines Beyond Middleware

5 Oct 2026 ](https://www.msaied.com/public/articles/the-pipeline-pattern-in-laravel-custom-pipelines-beyond-middleware-1) [ ![](https://cdn.msaied.com/739/2d6897fdcdcf090613f96f72a64b8a78.png)  · 4 min read### MySQL Full-Text Search in Laravel: Indexes, Relevance Scoring, and Boolean Mode

4 Oct 2026 ](https://www.msaied.com/public/articles/mysql-full-text-search-in-laravel-indexes-relevance-scoring-and-boolean-mode) [ ![](https://cdn.msaied.com/738/073696a3fefe18bec825beec5ac658f5.png)  · 4 min read### Laravel Queue Rate-Limited Middleware: Throttling Jobs Without Losing Work

4 Oct 2026 ](https://www.msaied.com/public/articles/laravel-queue-rate-limited-middleware-throttling-jobs-without-losing-work) 

  Have a technical challenge?
----------------------------

Tell me what you’re building. I reply within two working days.

 [Discuss your project ↗](https://www.msaied.com/public#contact) 

  © 2026 Mohamed Said · Built with Laravel, meant to last.Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

 - [Home](https://www.msaied.com/public)
- [Articles](https://www.msaied.com/public/articles)
- [Certificates](https://www.msaied.com/public/certificates)
- [GitHub](https://github.com/EG-Mohamed)
- [LinkedIn](https://www.linkedin.com/in/msaiedm/)
- [WhatsApp](https://wa.me/201094619204)
- [Email Address](mailto:hello@msaied.com)
- [My CV](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)
- [Sitemap](https://www.msaied.com/public/sitemap.xml)
