Mahmoud Al-HabashOpen to new projects
  • WorkWork
  • ServicesServices
  • LabLab
  • WritingWriting
  • ContactContact
Amman--:--عربي
Writing/Livewire

Debouncing and Throttling in Livewire v4

Control request frequency for better performance.

1 February 20261 min readLivewireاقرأ بالعربية

On this page

  1. Debounce - Wait for User to Stop Typing
  2. Throttle - Limit Request Frequency
  3. Comparison

Reduce server requests with debouncing and throttling for better performance.

Debounce - Wait for User to Stop Typing

blade
<!-- Debounce search input - waits 300ms after user stops typing -->
<input 
    type="search"
    wire:model.live.debounce.300ms="search"
    placeholder="Search products..."
>

<!-- Different debounce durations -->
<input wire:model.live.debounce.150ms="quickSearch">
<input wire:model.live.debounce.500ms="slowSearch">
<textarea wire:model.live.debounce.1s="content"></textarea>

Throttle - Limit Request Frequency

blade
<!-- Throttle button clicks - max once per 500ms -->
<button wire:click.throttle.500ms="refresh">
    Refresh Data
</button>

<!-- Throttle scroll events -->
<div 
    x-data 
    @scroll.window.throttle.200ms="$wire.loadMore()"
>
    Scroll content...
</div>

<!-- Throttle rapid form submissions -->
<form wire:submit.throttle.1s="save">
    <button type="submit">Save</button>
</form>

Comparison

Debounce: Waits until user STOPS, then fires once
- Use for: Search inputs, auto-save, validation
- Example: User types "hello" - fires once after typing stops

Throttle: Fires immediately, then limits frequency  
- Use for: Scroll handlers, resize events, rapid clicks
- Example: User clicks 10 times - fires max 2 times per second
All articles

Keep reading

  • Authorization in Livewire v4 Components1 February 20261 min read
  • Blaze Pre-Compiler: Massive Performance Gains in Livewire v41 February 20261 min read
  • Building a Bookmark Feature with Livewire v41 February 20261 min read