Skip to content

[6.x] Fix LivePreview listener leak and simplify Grid row updates#14583

Merged
jasonvarga merged 2 commits into6.xfrom
pr-a-impl
Apr 30, 2026
Merged

[6.x] Fix LivePreview listener leak and simplify Grid row updates#14583
jasonvarga merged 2 commits into6.xfrom
pr-a-impl

Conversation

@jasonvarga
Copy link
Copy Markdown
Member

@jasonvarga jasonvarga commented Apr 30, 2026

Two small fixes/improvements extracted from #14512

LivePreview event-listener leak

resources/js/components/ui/LivePreview/LivePreview.vue registers a live-preview.<name>.refresh handler on Statamic.$events but never $offs it on unmount, so navigating between live-preview-enabled entries leaks listeners. Hoisted the handler into a named const and $off it in onUnmounted alongside the existing keybinding.value.destroy().

Grid Row shallow spread

resources/js/components/fieldtypes/grid/Row.vue was deep-cloning the row/meta object on every field update (via JSON.parse(JSON.stringify(...)) and clone()) just to set a single key. Replaced with a shallow spread, which is enough since downstream consumers don't mutate the emitted object.

Since updated fires on every keystroke, the deep clone was walking the entire row's nested data (Bard docs, nested Replicator sets, etc.) on each character. The spread is a one-level copy, which on heavy rows is the difference between a noticeable typing lag and none.

jasonvarga and others added 2 commits April 30, 2026 15:17
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Waldemar Pankratz <waldemar.pankratz@voll.digital>
@jasonvarga jasonvarga merged commit 6a6aca3 into 6.x Apr 30, 2026
19 checks passed
@jasonvarga jasonvarga deleted the pr-a-impl branch April 30, 2026 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant