https://twill.io logo
Conditional select bug
# ❓questions
b
Hi guys. Just checked the this PR https://github.com/area17/twill/pull/2047 and found bug. If you have let's say select , and base on selected option you wanna see different fields. The problem is - that if you will select option A and see 123 fields, and then select option B you will still see 123fields + 456fields. Expected that if you select option B you will no see 123 fields.
I have changed method ToggleVisibility and now it's fine
Copy code
toggleVisibility: function (value) {
        if (this.$refs.fieldContainer) {
          this.$slots.default.forEach((child) => {
            // Base input fields.
            if (
              child.componentInstance !== undefined &&
              child.componentInstance.$refs &&
              child.componentInstance.$refs.field
            ) {
              if (child.componentInstance.$refs.field[0]) {
                child.componentInstance.$refs.field[0].destroyValue()
              }
            }
            // Special fields such as browsers.

            else if (
              child.componentInstance !== undefined &&
              child.componentInstance.$slots.default
            ) {
              child.componentInstance.$slots.default.forEach((subChild) => {
               if (subChild.componentInstance !== undefined) {
                 if (subChild.componentInstance.$refs.field && subChild.componentInstance.$refs.field[0]) {
                   subChild.componentInstance.$refs.field[0].destroyValue()
                 }
               }
              })
            }
          })
        }
i
Hi @BA7YA thanks for finding this. Could you submit a PR?
b
Sure!