Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
meryldakin committed Feb 21, 2024
1 parent 67b4a48 commit 7c07115
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,13 @@ export const SlackChannelCombobox = ({
// There are cases where a channel is "connected" in Knock, but it wouldn't be
// posting to it if the channel is private and the Slackbot doesn't belong to it,
// so the channel won't show up here and it won't be posted to.
const channels =
connectedChannels?.filter((connectedChannel) => {
return !!slackChannels.find(
(slackChannel) => slackChannel.id === connectedChannel.channel_id,
);
}) || [];
const slackChannelsMap = new Map(
slackChannels.map((channel) => [channel.id, channel]),
);

const channels = connectedChannels?.filter((connectedChannel) => {
return slackChannelsMap.has(connectedChannel.channel_id);
}) || [];

setCurrentConnectedChannels(channels);
}, [connectedChannels, slackChannels]);
Expand Down

0 comments on commit 7c07115

Please sign in to comment.