v17development / flarum-blog

The Flarum Blog extension
https://discuss.flarum.org/d/25392-blog-adds-a-blog-section-to-your-community
MIT License
46 stars 20 forks source link

Fix errors on tags page #156

Closed iPurpl3x closed 1 year ago

iPurpl3x commented 1 year ago

When the tags page UI is extended and customized, the current code that tries to manipulate the virtual DOM doing thing like

markup.children[1].children[1].children[0].children = tag_tiles.map(...

might break because the indexes of children have changed.

This PR adds a safer and more flexible way of manipulating the virtual DOM using a recursive helper function that searches for a node with a certain class name.

Tested locally on the instance that was failing and everything seems to be fine.

While making this PR I realized there was strange (seemingly copy-pasted) comments and code that was referring to "knowledge base" even though this is the blog extension and not the knowledge base extension.

iPurpl3x commented 1 year ago

@luceos or @davwheat would you be able to merge this and tag a new version? The sooner, the better, as we (@glowingblue) have this error in production currently.

iPurpl3x commented 1 year ago

Thanks for merging @davwheat !

Could you also tag a new version, please?

iPurpl3x commented 1 year ago

Ah it's tagged now, thanks !