Uploaded image for project: 'Nuxeo Web UI'
  1. Nuxeo Web UI
  2. WEBUI-648

Prevent validate and observer methods from being triggered twice

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Not A Bug
    • Affects Version/s: 2.4.0
    • Fix Version/s: None
    • Component/s: Web UI

      Description

      Steps to observe this behavior:

      1. edit nxserver/nuxeo.war/ui/document/file/nuxeo-file-edit-layout.html and add these lines
            observers: [
              '_titleChanged(document.properties.dc:title)',
            ],
            
            _titleChanged: function() {
              if(this.document) {
                alert("dc:title has changed");
              }
            },
        
            validate: function() {
              alert("Validation is done");
              return true;
            },
        
      1. force reload the Web UI
      2. navigate to a File document and open the Edit form
      3. change the title, observe the alert
      4. submit the Edit form for a File document
      5. Observe that the validation alert is displayed twice and the observer alert is also displayed twice

      Even if these methods should be idempotent, this double trigger could bring to a global performance issue when a form has many observers

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 days, 45 minutes
                2d 45m