1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-08-08 23:30:53 +00:00
* Added: Automatically reprocess chat messages when loading a channel for the first time. (Closes #1333)
* Fixed: Random emotes being insert into chat when using the emote menu in some situations. (Closes #1337)
* Fixed: When tokenizing messages, ignore fake emotes injected into Twitch's chat handler for the purpose of auto-completion and WYSIWYG support.
* Changed: Switch to a better method for how to get `require` from webpack.
* Changed: Update the logic used to calculate the container size when overlaying emotes.
* API Added: `load_tracker` module for waiting for multiple events to finish. This is used to reprocess chat lines once every data source has finished loading to avoid multiple unnecessary updates.
* API Added: Add-ons can now set a `load_events` array in their manifest to have the add-on loader register them with `load_tracker`, ensuring events don't fire before the add-on is able to execute.
This commit is contained in:
SirStendec 2023-03-10 17:06:12 -05:00
parent e26f836267
commit daa193aa03
17 changed files with 481 additions and 68 deletions

View file

@ -253,6 +253,9 @@ export default class Room {
if ( this.destroyed )
return;
const load_key = `ffz-room-${this.id ? `id:${this.id}` : this.login}`;
this.manager.load_tracker.schedule('chat-data', load_key);
if ( this.manager.experiments.getAssignment('api_load') )
try {
fetch(`${NEW_API}/v1/room/${this.id ? `id/${this.id}` : this.login}`).catch(() => {});
@ -267,16 +270,20 @@ export default class Room {
return setTimeout(() => this.load_data(tries), 500 * tries);
this.manager.log.error(`Error loading room data for ${this.id}:${this.login}`, err);
this.manager.load_tracker.notify('chat-data', load_key, false);
return false;
}
if ( ! response.ok )
if ( ! response.ok ) {
this.manager.load_tracker.notify('chat-data', load_key, false);
return false;
}
try {
data = await response.json();
} catch(err) {
this.manager.log.error(`Error parsing room data for ${this.id}:${this.login}`, err);
this.manager.load_tracker.notify('chat-data', load_key, false);
return false;
}
@ -296,6 +303,7 @@ export default class Room {
} else if ( this._id !== id ) {
this.manager.log.warn(`Received data for ${this.id}:${this.login} with the wrong ID: ${id}`);
this.manager.load_tracker.notify('chat-data', load_key, false);
return false;
}
@ -331,6 +339,7 @@ export default class Room {
this.buildModBadgeCSS();
this.buildVIPBadgeCSS();
this.manager.load_tracker.notify('chat-data', load_key);
return true;
}