From 028a280b93019c22edf3615692486042736c010b Mon Sep 17 00:00:00 2001 From: Kael Date: Mon, 4 Sep 2017 04:00:20 +1000 Subject: [PATCH] Improve speed of getInputs --- src/components/VForm/VForm.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/VForm/VForm.js b/src/components/VForm/VForm.js index ec4b45b82092..bd89aec66765 100644 --- a/src/components/VForm/VForm.js +++ b/src/components/VForm/VForm.js @@ -37,15 +37,18 @@ export default { getInputs () { const results = [] - const filter = el => typeof el.errorBucket !== 'undefined' - - const search = (children) => { + const search = (children, depth = 0) => { for (const child of children) { - filter(child) ? results.push(child) : search(child.$children) + if (child.errorBucket !== undefined) { + results.push(child) + } else { + search(child.$children, depth + 1) + } } + if (depth === 0) return results } - search(this.$children) + return search(this.$children) return results },