diff --git a/Plugins/BDFDB.js b/Plugins/BDFDB.js index b0ef43ef8d..68bfa19699 100644 --- a/Plugins/BDFDB.js +++ b/Plugins/BDFDB.js @@ -1966,6 +1966,23 @@ } }; + BDFDB.MessageUtils = {}; + BDFDB.MessageUtils.rerenderAll = function () { + let MessagesIns = BDFDB.ReactUtils.findOwner(document.querySelector(BDFDB.dotCN.app), {name:"Messages", unlimited:true}); + let MessagesPrototype = BDFDB.ReactUtils.getValue(MessagesIns, "_reactInternalFiber.type.prototype"); + if (MessagesIns && MessagesPrototype) { + let patchCancel = BDFDB.ModuleUtils.patch(BDFDB, MessagesPrototype, "render", {after:e => { + patchCancel(); + let [children, index] = BDFDB.ReactUtils.findChildren(e.returnValue, {props: ["message", "channel"]}); + if (index > -1) { + for (let i in children) children[i] = null; + BDFDB.ReactUtils.forceUpdate(MessagesIns); + } + }}); + BDFDB.ReactUtils.forceUpdate(MessagesIns); + } + }; + BDFDB.UserUtils = {}; var myDataUser = LibraryModules.CurrentUserStore ? LibraryModules.CurrentUserStore.getCurrentUser() : null; BDFDB.UserUtils.is = function (user) {