Skip to content

Commit

Permalink
Clear active emotes on reset
Browse files Browse the repository at this point in the history
  • Loading branch information
Excellify committed Jun 20, 2024
1 parent 0865e60 commit 5223965
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/composable/chat/useChatEmotes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function useChatEmotes(ctx: ChannelContext) {
m.set(ctx, x);
}

function resetProviders() {
function reset() {
if (!x) return;

for (const k in x.providers) {
Expand All @@ -42,6 +42,12 @@ export function useChatEmotes(ctx: ChannelContext) {
delete x.providers[k as SevenTV.Provider][k2];
}
}

for (const k in x.active) {
const ae = x.active[k];
if (ae.provider === "EMOJI") continue;
delete x.active[k];
}
}

function byProvider(provider: SevenTV.Provider) {
Expand Down Expand Up @@ -75,7 +81,7 @@ export function useChatEmotes(ctx: ChannelContext) {
sets: x.sets,
emojis: x.emojis,
providers: x.providers,
resetProviders,
reset,
byProvider,
find,
});
Expand Down
2 changes: 1 addition & 1 deletion src/site/twitch.tv/modules/chat/ChatController.vue
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ watch(
messages.clear();
scroller.unpause();
nextTick(() => emotes.resetProviders());
nextTick(emotes.reset);
},
{ immediate: true },
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export function useTrayRef(options: Twitch.CustomTrayOptions, modifier: boolean
$$typeof: REACT_ELEMENT_SYMBOL,
key: "body",
ref: (e: TrayRef) => (bodyRef.value = e),
type: "seventv-vue-component",
type: "seventv-tray-container-body",
props: {},
};

Expand Down
1 change: 1 addition & 0 deletions src/site/twitch.tv/modules/chat/components/tray/Tray.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const props = withDefaults(
messageHandler?: (v: string) => void;
placeholder?: string;
modifier?: boolean;
floating?: boolean;
}>(),
{
modifier: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
placeholder="Search again..."
:input-value-override="search"
disable-commands
floating
:message-handler="(m) => (search = m)"
>
<EnableTray :search="search" :mut="mut" name="body" @close="showTray = false" />
Expand Down
1 change: 1 addition & 0 deletions src/types/twitch.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ declare module Twitch {
sendMessageHandler?: ChatTray.SendMessageHandler<H>;
messageHandler?: (v: string) => void;
placeholder?: string;
floating?: boolean;
}

export namespace ChatTray {
Expand Down

0 comments on commit 5223965

Please sign in to comment.