Skip to content

Commit 0991c01

Browse files
committed
fix: devtools crashing when a field name is defined as getter
1 parent 5f1537a commit 0991c01

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed
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 crashing when a field name is defined as getter

packages/vee-validate/src/devtools.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { App, ComponentInternalInstance, getCurrentInstance, nextTick, onUnmounted, unref } from 'vue';
1+
import { App, ComponentInternalInstance, getCurrentInstance, nextTick, onUnmounted, toValue, unref } from 'vue';
22
import { setupDevtoolsPlugin } from '@vue/devtools-api';
33
import type { InspectorNodeTag, CustomInspectorState, CustomInspectorNode } from '@vue/devtools-kit';
44
import { PathState, PrivateFieldContext, PrivateFormContext } from './types';
@@ -216,7 +216,7 @@ function mapFormForDevtoolsInspector(form: PrivateFormContext): CustomInspectorN
216216

217217
const formTreeNodes = {};
218218
Object.values(form.getAllPathStates()).forEach(state => {
219-
setInPath(formTreeNodes, unref(state.path), mapPathForDevtoolsInspector(state, form));
219+
setInPath(formTreeNodes, toValue(state.path), mapPathForDevtoolsInspector(state, form));
220220
});
221221

222222
function buildFormTree(tree: any[] | Record<string, any>, path: string[] = []): CustomInspectorNode {
@@ -271,7 +271,7 @@ function mapFormForDevtoolsInspector(form: PrivateFormContext): CustomInspectorN
271271
function mapPathForDevtoolsInspector(state: PathState, form?: PrivateFormContext): CustomInspectorNode {
272272
return {
273273
id: encodeNodeId(form, state),
274-
label: unref(state.path),
274+
label: toValue(state.path),
275275
tags: getFieldNodeTags(state.multiple, state.fieldsCount, state.type, state.valid, form),
276276
};
277277
}

0 commit comments

Comments
 (0)