Skip to content

Commit 215b817

Browse files
duncanmccleanclaude
andcommitted
fix broken exposed ref access when adding custom validation rules
`defineExpose` unwraps refs, so `searchQuery.value` was `undefined` and `hasUnfinishedParameters` threw inside the `added` handler. Previously the rule had already been added by the time the error was swallowed; now `added` is emitted before the selection lands, so the throw aborted it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0146FsnrtqFd6RhsnrEDf7Fy
1 parent 0932c04 commit 215b817

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

resources/js/components/field-validation/Builder.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,9 @@ export default {
256256
257257
ifSearchNotFoundAddCustom() {
258258
let rulesSelect = this.$refs.rulesSelect;
259-
let rule = rulesSelect.searchQuery.value;
259+
let rule = rulesSelect?.searchQuery;
260260
261+
if (!rule) return;
261262
if (this.searchNotFound(rulesSelect) || this.hasUnfinishedParameters(rule)) return;
262263
263264
this.add(rule);
@@ -272,7 +273,7 @@ export default {
272273
},
273274
274275
searchNotFound(rulesSelect) {
275-
return rulesSelect.searchQuery.value?.length === 0 || rulesSelect?.filteredOptions.length === 0;
276+
return rulesSelect.filteredOptions.length === 0;
276277
},
277278
278279
updated(rules) {

0 commit comments

Comments
 (0)