Album shown as empty - Error fetching album data TypeError: "t[n].localeCompare is not a function"

Using Firefox I get some albums shown as empty although they are not. The web console shows:

Error fetching album data TypeError: “t[n].localeCompare is not a function”
c fileUtils.js:96
o folders.js:43
updateFolders folders.js:43
h vuex.esm.js:740
commit vuex.esm.js:392
commit vuex.esm.js:391
_withCommit vuex.esm.js:522
commit vuex.esm.js:390
commit vuex.esm.js:335
updateFolders folders.js:85
h vuex.esm.js:747
dispatch vuex.esm.js:438
dispatch vuex.esm.js:332
e Albums.vue:200
c Multiselect.js:119
_invoke Multiselect.js:119
e Multiselect.js:119
k photos.6.js:22
i photos.6.js:22

Does anyone else see this?

Same for Opera:

Albums.vue:214 Error fetching album data TypeError: t[n].localeCompare is not a function
at c (fileUtils.js:96)
at folders.js:43
at Array.sort ()
at updateFolders (folders.js:43)
at vuex.esm.js:740
at vuex.esm.js:392
at Array.forEach ()
at vuex.esm.js:391
at u._withCommit (vuex.esm.js:522)
at u.commit (vuex.esm.js:390)

or Chrome:
Albums.vue:214 Error fetching album data TypeError: t[n].localeCompare is not a function
at c (fileUtils.js:96)
at folders.js:43
at Array.sort ()
at updateFolders (folders.js:43)
at vuex.esm.js:740
at vuex.esm.js:392
at Array.forEach ()
at vuex.esm.js:391
at u._withCommit (vuex.esm.js:522)
at u.commit (vuex.esm.js:390)

I think this started with 18.0.4.

I had the same problem and finally figured it out.
In my case the fault was exactly with one file in the directory. In my case this file had a modificationDate of 0 reported by nextcloud instead of a positive integer.
This caused the compare function of the file sorting to throw an exception.

I fixed it by rescanning that folder with
sudo -u www-data php occ files:scan username --path /username/problematicfolder

(
I also touched the file on the command line to update the modification time, but that should not be necessary. I think something went wrong when nextcloud initially scanned the file. If you still have problems maybe set the modification time of the file manually with the touch command and then rescan the folder again:
touch -a -m -t 202005061312 problematic_file_taken_on_2020_05_06_at_13_12.jpg
)