Fixes 2 sync and UI bugs in music-together plugin (#4071)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
HasselAssel
2025-12-19 08:13:56 +01:00
committed by GitHub
parent 58a19cdaa2
commit 92a943c755
3 changed files with 66 additions and 4 deletions

View File

@ -9,9 +9,11 @@ import delay from 'delay';
import type { Permission, Profile, VideoData } from './types';
export type ConnectionEventMap = {
CLEAR_QUEUE: {};
ADD_SONGS: { videoList: VideoData[]; index?: number };
REMOVE_SONG: { index: number };
MOVE_SONG: { fromIndex: number; toIndex: number };
SET_INDEX: { index: number };
IDENTIFY: { profile: Profile } | undefined;
SYNC_PROFILE: { profiles: Record<string, Profile> } | undefined;
SYNC_QUEUE: { videoList: VideoData[] } | undefined;
@ -171,9 +173,10 @@ export class Connection {
public async broadcast<Event extends keyof ConnectionEventMap>(
type: Event,
payload: ConnectionEventMap[Event],
after?: ConnectionEventUnion[],
) {
await Promise.all(
this.getConnections().map((conn) => conn.send({ type, payload })),
this.getConnections().map((conn) => conn.send({ type, payload, after })),
);
}