From 6f5cf50ba9b70a5c3d97683894eeb04cb8c846d5 Mon Sep 17 00:00:00 2001 From: FlxRobole Date: Mon, 10 Aug 2026 15:22:46 +0200 Subject: [PATCH 1/3] feat: configurable live-preview debounce duration --- config/live_preview.php | 12 ++++++++++++ .../js/components/ui/LivePreview/LivePreview.vue | 4 +++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/config/live_preview.php b/config/live_preview.php index b5da9a0f8cd..e30eb296e1c 100644 --- a/config/live_preview.php +++ b/config/live_preview.php @@ -33,6 +33,18 @@ // ], + /* + |-------------------------------------------------------------------------- + | Debounce + |-------------------------------------------------------------------------- + | + | The number of milliseconds to wait before updating Live Preview after + | content changes. + | + */ + + 'debounce_ms' => max(0, (int) env('LIVE_PREVIEW_DEBOUNCE_MS', 150)), + /* |-------------------------------------------------------------------------- | Force Reload Javascript Modules diff --git a/resources/js/components/ui/LivePreview/LivePreview.vue b/resources/js/components/ui/LivePreview/LivePreview.vue index 0b092a0fb95..c10ec99ec10 100644 --- a/resources/js/components/ui/LivePreview/LivePreview.vue +++ b/resources/js/components/ui/LivePreview/LivePreview.vue @@ -106,6 +106,8 @@ watch( { deep: true }, ); +const livePreviewDebounceMs = Statamic.$config.get('livePreview.debounce_ms', 150); + const update = debounce(() => { if (source) source.abort(); source = new AbortController(); @@ -128,7 +130,7 @@ const update = debounce(() => { if (e.code === 'ERR_CANCELED') return; throw e; }); -}, 150); +}, livePreviewDebounceMs); function componentUpdated(handle, value) { extras.value[handle] = value; From a0a84902fa2ef7567d91757c6f879a9625fd4c98 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Mon, 10 Aug 2026 15:53:42 -0400 Subject: [PATCH 2/3] prefix env var with statamic --- config/live_preview.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/live_preview.php b/config/live_preview.php index e30eb296e1c..200211656a7 100644 --- a/config/live_preview.php +++ b/config/live_preview.php @@ -43,7 +43,7 @@ | */ - 'debounce_ms' => max(0, (int) env('LIVE_PREVIEW_DEBOUNCE_MS', 150)), + 'debounce_ms' => max(0, (int) env('STATAMIC_LIVE_PREVIEW_DEBOUNCE_MS', 150)), /* |-------------------------------------------------------------------------- From 8b78cc5bc63d9ea036106c251c8077abf9dcea79 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Tue, 11 Aug 2026 13:22:46 -0400 Subject: [PATCH 3/3] max was overkill --- config/live_preview.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/live_preview.php b/config/live_preview.php index 200211656a7..6e213fc953f 100644 --- a/config/live_preview.php +++ b/config/live_preview.php @@ -43,7 +43,7 @@ | */ - 'debounce_ms' => max(0, (int) env('STATAMIC_LIVE_PREVIEW_DEBOUNCE_MS', 150)), + 'debounce_ms' => (int) env('STATAMIC_LIVE_PREVIEW_DEBOUNCE_MS', 150), /* |--------------------------------------------------------------------------