1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-09-17 02:16:54 +00:00
* Fixed: Clicking emotes in the FFZ Emote Menu. (Broken by a Twitch update.)
This commit is contained in:
SirStendec 2020-03-05 18:21:11 -05:00
parent aedfcecc14
commit 40cae9f115
6 changed files with 57 additions and 7 deletions

View file

@ -621,7 +621,9 @@ export default class ChatHook extends Module {
onEnable() {
this.on('site.web_munch:loaded', this.grabTypes);
this.on('site.web_munch:loaded', this.defineClasses);
this.grabTypes();
this.defineClasses();
this.chat.context.on('changed:chat.points.show-callouts', () => {
this.InlineCallout.forceUpdate();
@ -974,8 +976,29 @@ export default class ChatHook extends Module {
this.ChatContainer.ready((cls, instances) => {
const t = this,
old_render = cls.prototype.render,
old_catch = cls.prototype.componentDidCatch;
cls.prototype.render = function() {
//try {
if ( t.CommunityStackHandler ) {
const React = t.web_munch.getModule('react'),
out = old_render.call(this),
thing = out?.props?.children?.props?.children;
if ( React && Array.isArray(thing) )
thing.push(React.createElement(t.CommunityStackHandler));
return out;
}
/*} catch(err) {
// No op
}*/
return old_render.call(this);
}
// Try catching errors. With any luck, maybe we can
// recover from the error when we re-build?
cls.prototype.componentDidCatch = function(err, info) {
@ -1006,6 +1029,32 @@ export default class ChatHook extends Module {
}
defineClasses() {
if ( this.CommunityStackHandler )
return true;
const t = this,
React = this.web_munch.getModule('react'),
Stack = this.web_munch.getModule('highlightstack'),
createElement = React && React.createElement;
if ( ! createElement || ! Stack || ! Stack.b )
return false;
this.CommunityStackHandler = function() {
const stack = React.useContext(Stack.b),
dispatch = React.useContext(Stack.c);
t.community_stack = stack;
t.community_dispatch = dispatch;
return null;
}
this.ChatContainer.forceUpdate();
}
updatePinnedCallouts() {
for(const inst of this.PinnedCallout.instances)
this.onPinnedCallout(inst);