Description
Describe the bug
If you try to list the files of a non-existent folder with upload enabled, it renders an alert with "TypeError: this.files is not iterable".
To Reproduce
Steps to reproduce the behavior:
Add a with driveId and (dynamic) itemPath to a not-existent folder and set enableFileUpload to true
Expected behavior
In a previous version (dont know which one), it worked fine and rendered an empty list with the upload button and created the folder automatically once the user tried to upload.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
- OS: Windows 11
- Browser Chrome 135.0.7049.115
- Framework react 18
- Context Microsoft Graph Toolkit / Sharepoint
- Version 4.6.0
- Provider msal-browser
Additional context
I have not yet properly looked into the sourcecode but maybe the issue is caused by this commit
1afd741#diff-ea50374a9481c1b89f7534b06d94d7c95e3f00ea45f2901ff0686e72b7e13647
These line were added without checking if this.files
might be null
for (const file of this.files) {
if (file?.folder?.childCount > 0) {
// expand the file with children
const driveId = file?.parentReference?.driveId;
const itemId = file?.id;
const iterator = await getDriveFilesByIdIterator(graph, driveId, itemId, 5);
if (iterator) {
const children = [...iterator.value];
file.children = children;
}
}
}
Metadata
Metadata
Assignees
Labels
Type
Projects
Status