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?