HideSidebar: Button removed when rerendering
Closed this issue · 6 comments
If anything rerenders the sidebar, as some plugins that change folder behaviour like ServerFolders do, the button will be removed because the sidebar is replaced. The way to fix it without patching the sidebar would be using the observer
method to detect the rerendering and apply the changes again.
See https://github.com/QbDesu/BetterDiscordAddons/blob/potato/Plugins/PanelPopout/PanelPopout.plugin.js#L120-L133 for an exaple on how this could be done.
BdApi.findModuleByProps('sidebar','sidebarRegion')?.sidebar
to programmatically get the class for the sidebar btw.
And BdApi.findModuleByProps('scroller')?.scroller
and BdApi.findModuleByProps('scrollerBase')?.scrollerBase
for the server list.
BdApi.injectCSS(id, css)
and BdApi.clearCSS(id)
are utility functions for plugins to add styles. (even if it works similar to your method)
https://github.com/rauenzi/BetterDiscordApp/wiki/Creating-Plugins#injectcssid-css
oooh thank you so much ^^ I'll have a look at fixing it today
Any updates on this? The plugin works great in general but for it to work, I need to enter plugin settings and restart it, I presume some other plugin rerenders the sidebar on startup (as I can see the button for a second after starting Discord)
I couldn’t get it fixed before I went away on holiday, just got home yesterday, so started working on it again today, will hopefully have it updated for approval by Monday or Tuesday