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

Fix nuxeo-document-preview performances

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.0
    • Fix Version/s: 2.3.3
    • Component/s: UI, Viewers

      Description

      When navigating to a document which has a nuxeo-document-preview.html we can notice that the _updateBlob method is called up to 5 times.

      In case of a pdf document, this involves that the pdf viewer will be loaded 5 times uselessly issuing 5 times a request to fetch the pdf blob attached to the document (which will be mitigated by NXP-25385 anyway).

      This may be one of the cause of slowness observed on cheap machines when navigating from a document to another one (when it has a main blob attached).

      Note the cause is the pattern of the element: the declaration of all the observers (_computeImageSource, _computeVideoSources, _computeStoryboard, _computeAudioSource, _computeIFrameSource) Each of them ends up calling _updateBlob.

              static get properties() {
                return {
                  /**
                   * Document
                   */
                  document: Object,
                  /**
                   * By default it will display a preview of the main file.
                   * For example using `xpath="files:files/0/file"` will display the preview of the document's first attachment.
                   */
                  xpath: {
                    type: String,
                    value: 'file:content',
                  },
                  _blob: Object,
                  _imageSource: {
                    type: String,
                    computed: '_computeImageSource(document)',
                  },
                  _videoSources: {
                    type: Array,
                    computed: '_computeVideoSources(document)',
                  },
                  _storyboard: {
                    type: Array,
                    computed: '_computeStoryboard(document)',
                  },
                  _audioSource: {
                    type: String,
                    computed: '_computeAudioSource(document)',
                  },
                  _iFrameSource: {
                    type: String,
                    computed: '_computeIFrameSource(document)',
                  },
                };
              }
              static get observers() {
                return [
                  '_updateBlob(document, xpath)',
                ];
              }
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 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 - 3 hours
                  3h

                    PagerDuty

                    Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.