Uploaded image for project: 'Nuxeo Elements'
  1. Nuxeo Elements
  2. ELEMENTS-1371

nuxeo-search-form timing with DOM injection causing loading to hang

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Layouts, Widgets

      Description

      Search Form hangs with loading spinner

       

      Code bellow depends on method _fetch is called  with the parameter el is not null. Otherwise the loading spinner would be displayed indefinitely.

       

      In real life depending on the timing it often happens that this.$.provider is not injected in DOM yet when _fetch is called and the search form on the screen hangs forever.

      Issue is hard to reproduce in a test environment but it happens with client site all the time. It might depend on the responsiveness of the server.

       

      The intermediate solution will be is to check if $.provider is set before going to el.fetch .

       

      A more complete way to address it should be waiting for $.provider injection be complete. 

       

      It might be a part of a bigger issue for templates be injected asynchronously in slots  and there is no confirmation event/callback available to notify when template injection process is complete. Besides this ticket that causes problem with attaching additional logic to UI elements.

       

      https://github.com/nuxeo/nuxeo-web-ui/blob/master/elements/search/nuxeo-search-form.js

      _visibleChanged() 
       {    
        if (this.visible) {      
          if (!this._searches) {        
            this.$['saved-searches'].get();        
            if (this.form && this.form.params !== undefined) {         
                this.params = this.form.params;       
            }      
          }      
          if (this.queue) {        
           this.$.list.fetch();      
          } 
          else if (this.auto) {        
           this._fetch(this.$.provider);      //!!!PROBLEM this.$.provider might be undefined
          }    
        }//END: visible  
      },
      
      
       _fetch(el) {   
          this.loading = true; //SET UNCONDITIONALLY EVEN IF EL IS NULL, PLUS I AM NOT SURE THAT "THIS" IS PROPERLY BOUND ON CALLBACK
          return el.fetch().then(() => {this.loading = false; }).catch((err) => {this.loading = false; throw err;});  
      },
      
      

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ssokolov Stan Sokolov
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: