Skip to content

Commit e8f5d42

Browse files
authored
fix: Shared references causing auto thread to be added to new channels (#464)
* fix: Shared references causing auto thread to be added to new channels * fix: removed print statement
1 parent 91afde6 commit e8f5d42

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,10 @@ const addHandler = (
125125
channels.forEach((channelId) => {
126126
const existingHandlers = channelHandlersById[channelId];
127127
if (existingHandlers) {
128-
existingHandlers.push(...handlers);
128+
// Create a new array to avoid mutating the existing one
129+
channelHandlersById[channelId] = [...existingHandlers, ...handlers];
129130
} else {
130-
channelHandlersById[channelId] = handlers;
131+
channelHandlersById[channelId] = [...handlers];
131132
}
132133
});
133134
};

0 commit comments

Comments
 (0)