Skip to content

Commit 34b670b

Browse files
fix(devtools): prevent SSR memory leak in DevTools integration (#5102)
Add SSR guards to DevTools registration functions to prevent memory leaks in server-side environments by checking both __DEV__ and isClient. Fixes #4978 Co-authored-by: Patrik Vogel <[email protected]>
1 parent e1daa52 commit 34b670b

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

.changeset/slow-masks-learn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'vee-validate': patch
3+
---
4+
5+
fix(devtools): prevent SSR memory leak in DevTools integration

packages/vee-validate/src/devtools.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ export const refreshInspector = throttle(() => {
176176
}, 100);
177177

178178
export function registerFormWithDevTools(form: PrivateFormContext) {
179+
if (!__DEV__ || !isClient) {
180+
return;
181+
}
182+
179183
const vm = getCurrentInstance();
180184
if (!API) {
181185
const app = vm?.appContext.app;
@@ -197,6 +201,10 @@ export function registerFormWithDevTools(form: PrivateFormContext) {
197201
}
198202

199203
export function registerSingleFieldWithDevtools(field: PrivateFieldContext) {
204+
if (!__DEV__ || !isClient) {
205+
return;
206+
}
207+
200208
const vm = getCurrentInstance();
201209
if (!API) {
202210
const app = vm?.appContext.app;

0 commit comments

Comments
 (0)