I’m having a strange issue with the media manager on one of my Modx Installs. When deleting files, I can remove the first file, and the grid is updated, but all subsequent delete actions remove the files but the grid isn’t updated. In the console there is a JS error from extjs:
ext-all.js:21 Uncaught TypeError: Cannot read properties of null (reading 'firstChild')
at MODx.tree.TreeLoader.load (ext-all.js:21:494160)
at MODx.tree.Directory.refreshParentNode (modx.tree.js:724:30)
at MODx.browser.View.fn (modx.browser.js:236:38)
at h.Event.fire (ext-all.js:21:3699)
at MODx.Msg.fireEvent (ext-all.js:21:687)
at MODx.Msg.fn (modx.js?v=f3fd0b2e:781:34)
at MODx.Ajax._runCallback (modx.js?v=f3fd0b2e:669:12)
at MODx.Ajax.success (modx.js?v=f3fd0b2e:628:30)
at Ext.data.Connection.handleResponse (ext-all.js:21:51106)
at f (ext-base.js:21:17840)
Step to reproduce
Go to Media Manager
Open directory with files
Right click file and delete
After delete, select next file
Right click and delete
File thumbnail stays in grid, but on refresh is removed
When you open the “Network” tab of the developer tools in the browser and delete the media files. Are the generated requests successful? Is their response correct?
There is a somewhat similar issue on github, but I can’t reproduce that behavior as well:
When the first file is deleted there is a request sent to browser/directory/getList which reloads the grid. But this is not firing on the second delete due to JS erroring out.
The only difference I can see on the response between a working install and this is the ID generated for the files. On the working install, the IDs use an encoded version of the path: %2Fassets%2Ftest%2FButterfly%20valvve.jpg. While the problem install returns /assets/test/Butterfly valvve.jpg.
Think I’m going mad. I prettified the manager/assets/ext3/ext-all.js file to add some console logs… and now it works. Tried resetting the file back to its minified self, but it’s still working.
Not complaining, just stumped as to why it would be working even with the original code.