Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-24988

Check for empty document in nuxeo-document-tree -> _currentDocumentChanged()

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 10.1
    • Fix Version/s: 11.1, 2021.0
    • Component/s: Web UI

      Description

      I have a situation where nuxeo-document-tree -> _currentDocumentChanged() is receiving an empty document, which causes the code to fail with Cannot read property 'startsWith' of undefined. It’s because I added a filter to the slot contrib a la:

      <nuxeo-slot-content name="personalWorkspaceDrawerPage" slot="DRAWER_PAGES">
        <template>
          <nuxeo-filter group="administrators" user="[[user]]">
            <template>
              <nuxeo-document-tree name="personalWorkspace" label="app.personalSpace" current-document="[[document]]" root-doc-path="[[userWorkspace]]"></nuxeo-document-tree>
            </template>
          </nuxeo-filter>
        </template>
      </nuxeo-slot-content>
      

      If I modify https://github.com/nuxeo/nuxeo-web-ui/blob/cd0c292e8093cbbca6a9f7a2a0cb4f664de7212d/elements/nuxeo-document-tree/nuxeo-document-tree.html#L275 to be:

      if (doc && doc.path && doc.path.startsWith(this.rootDocPath)) {
      

      it works with my filter, so maybe the code could be improved?

        Attachments

          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 - 1 hour
                1h