FilesInput wont complete load on Folder drop with an Empty folder at end of Parse

so the callback for the FilesInput _onReloadCallback I believe does not get fired, given the current logic, if a there is an empty folder as the last entity.

I stripped out the if statments on lines 150 and 160

to just read:

--remaining.count
callback()

and all seems to work as expected.

I think that instead of doing remaining.count += entries.length; we should count the number of entries for which isFile = true and isDirectory = false (because directory count is already taken care line 242) and add this to remaining.count: maybe there are entries that can have isFile = false and isDirectory = false?

However, I think @Deltakosh will know more about this.

In any case, I don’t understand why you would want to remove the if statements at line 150 / 160, that means the callback will be called each time a file or directory is processed(?), whereas it seems from the code the callback should be called once only when all files/directories are processed.

In the callback it checks if its complete and then fires the real callback. Otherwise the final parsing never fires because with that logic the way it is if the last one is a folder it skips firing the callback entirely.

The callback is always:

this._processFiles(files);
if (remaining.count === 0) {
    this._processReload();
}

But wont reach this._processReload(); in the current setup I described unless the ifs are removed. It sits at 1 item remaining.

By looking at the code I can’t see why having an empty folder (being it as the end or anywhere in the list) would make the counter off by 1, but I may miss something…

Are you able to provide a repro for this?

Select a glb and a folder with a blank folder inside it, then drag and drop those items onto the PG.

Or even just a blank folder and a glb, obj etc should show it as well.

A === 0 is missing in the 2nd test (didn’t see it even after looking at the code several times…).

PR: