<commit_before>export default {
  name: 'v-form',

  inheritAttrs: false,

  data () {
    return {
      inputs: 0,
      errorBag: {}
    }
  },

  props: {
    value: Boolean
  },

  watch: {
    errorBag: {
      handler () {
        const keys = Object.keys(this.errorBag)
        if (keys.length < this.inputs) return false

        const errors = keys.reduce((errors, key) => {
          errors = errors || this.errorBag[key]
          return errors
        }, false)

        this.$emit('input', !errors)

        return !errors
      },
      deep: true
    }
  },

  methods: {
    getInputs () {
      return this.$children.filter(child => {
        return typeof child.errorBucket !== 'undefined'
      })
    },
    validate () {
      const errors = this.getInputs().reduce((errors, child) => {
        const error = !child.validate(true)
        return errors || error
      }, false)

      return !errors
    },
    reset () {
      this.getInputs().forEach((input) => input.reset())
    }
  },

  mounted () {
    this.$vuetify.load(() => {
      this.getInputs().forEach((child) => {
        this.inputs += 1

        // Only start watching inputs if we need to
        child.$watch('shouldValidate', (val) => {
          if (!val) return

          // Only watch if we're not already doing it
          if (this.errorBag.hasOwnProperty(child._uid)) return

          child.$watch('valid', (val) => {
            this.$set(this.errorBag, child._uid, !val)
          }, { immediate: true })
        })
      })
    })
  },

  render (h) {
    return h('form', {
      attrs: this.$attrs,
      on: this.$listeners
    }, this.$slots.default)
  }
}<commit_msg>fixes #1571<commit_after>export default {
  name: 'v-form',

  inheritAttrs: false,

  data () {
    return {
      inputs: 0,
      errorBag: {}
    }
  },

  props: {
    value: Boolean
  },

  watch: {
    errorBag: {
      handler () {
        const keys = Object.keys(this.errorBag)
        if (keys.length < this.inputs) return false

        const errors = keys.reduce((errors, key) => {
          errors = errors || this.errorBag[key]
          return errors
        }, false)

        this.$emit('input', !errors)

        return !errors
      },
      deep: true
    }
  },

  methods: {
    getInputs () {
      return this.$children.filter(child => {
        return typeof child.errorBucket !== 'undefined'
      })
    },
    validate () {
      const errors = this.getInputs().reduce((errors, child) => {
        const error = !child.validate(true)
        return errors || error
      }, false)

      return !errors
    },
    reset () {
      this.getInputs().forEach((input) => input.reset())
    }
  },

  mounted () {
    this.$vuetify.load(() => {
      this.getInputs().forEach((child) => {
        this.inputs += 1

        // Only start watching inputs if we need to
        child.$watch('shouldValidate', (val) => {
          if (!val) return

          // Only watch if we're not already doing it
          if (this.errorBag.hasOwnProperty(child._uid)) return

          child.$watch('valid', (val) => {
            this.$set(this.errorBag, child._uid, !val)
          }, { immediate: true })
        })
      })
    })
  },

  render (h) {
    return h('form', {
      attrs: this.$attrs,
      on: {
        submit: e => this.$emit('submit', e)
      }
    }, this.$slots.default)
  }
}
{'fraction_non_alphanumeric': 0.15364199351223828, 'fraction_numerical': 0.0023591860808021233, 'mean_word_length': 1.7894736842105263, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4096454', 'n_tokens_mistral': 1049, 'n_tokens_neox': 1021, 'n_words': 226}