Uploaded image for project: 'SR for Jira - Development'
  1. SR for Jira - Development
  2. SRJIRA-4338

behaviours infinite loop when using two select2 fields, with behaviours on each

    Details

    • Type: Bug
    • Status: Done (View Workflow)
    • Priority: High
    • Resolution: Done
    • Affects Version/s: 5.8.0-p5
    • Fix Version/s: 6.2.0
    • Component/s: None
    • Labels:
      None
    • Sprint:
      SR4J Sprint 78
    • Critical Points:
      0.8

      Description

      It's possible to set up an infinite loop, but using two selects, each that set the value of the other (to eg None).

      This only happens with select2 fields, for example, standard single selects (but only using the service desk view), or possibly say fixVersions and components system fields.

       To reproduce in Service Desk.

      Add two single select list  fields, it doesn't matter what options they have.

      Add this behaviour on the first:

      def fieldA = getFieldByName('SelectListA')
      if (!fieldA.value) {
          def fieldB = getFieldByName('SelectListB')
          // if (fieldB.value) {
              fieldB.setFormValue("None")
          // }
      }
      

      Add a similar behaviour on the second, with the fields inverted. The idea is setting either to None will set the other to None.

      This will cause each field to continually set the value of the other.

      The problem happens because with select2 fields we have to clear out the options then add them back, so an event is fired on the field even though it has not changed.

      Workaround

      Only set the field to None if it's not already None. This can be done by uncommenting the lines in the example above.
       

       

        Attachments

          Structure

            Activity

              People

              Assignee:
              jechlin Jamie Echlin
              Reporter:
              jechlin Jamie Echlin
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Structure Helper Panel