Resize Debounce
Control the resize call frequency using the resizeDebounce and maxResizeDebounce options.
Try dragging the bottom-right corner of the container and compare the resize call frequency between the two carousels.
- JavaScript
- React
- Vue@3
Summary
Key Options
| Option | Type | Default | Description |
|---|---|---|---|
resizeDebounce | number | 0 | Resize call debounce delay (ms) |
maxResizeDebounce | number | 100 | Maximum debounce delay guarantee (ms) |
Behavior Comparison
| Setting | Behavior | Best For |
|---|---|---|
resizeDebounce: 0 | Resize called immediately on size change | General use (default) |
resizeDebounce: 300 | Called after 300ms of no changes | Performance optimization during frequent size changes |
resizeDebounce: 300 + maxResizeDebounce: 800 | 300ms debounce + guaranteed every 800ms max | Periodic updates needed even during continuous changes |
Details
resizeDebounce
resizeDebounce delays the resize call by the specified time. If the size changes again during the delay, the timer is reset.
maxResizeDebounce
maxResizeDebounce guarantees a maximum delay for debouncing. Even if resizeDebounce is set and continuous size changes occur, resize is executed at least once every maxResizeDebounce milliseconds.
Use Cases
When should you use this?
- Chat/live feeds: Reduce frequent resize calls with
resizeDebounce - Draggable layouts: Guarantee intermediate updates with
resizeDebounce+maxResizeDebounce - Typical responsive: Respond immediately with the default (
resizeDebounce: 0)
Notes
Caution
- If the
resizeDebouncevalue is too large, users may see panels repositioning late after a size change maxResizeDebounceis only meaningful whenresizeDebounceis greater than 0
Related Links
Related Options
resizeDebounce: Resize debouncemaxResizeDebounce: Maximum debounce
Related Demos
- Auto Resize: Resize detection method settings
- Optimize Size Update: Skip unnecessary axis changes