Skip to content

Commit

Permalink
fix(settings): sort followed channels by name
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldszar committed Aug 9, 2023
1 parent 2f8ea1a commit 6542456
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/browser/views/settings/NotificationSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { sortBy } from "lodash-es";
import { useMemo } from "react";
import tw, { styled } from "twin.macro";

import { t } from "~/common/helpers";
Expand All @@ -22,6 +24,11 @@ export function Component() {

const { data: followedChannels = [] } = useFollowedChannels();

const sortedFollowedChannels = useMemo(
() => sortBy(followedChannels, "broadcasterName"),
[followedChannels],
);

return (
<div>
<Section>
Expand All @@ -45,7 +52,7 @@ export function Component() {
<CheckboxGrid
{...register("notifications.selectedUsers")}
disabled={!settings.notifications.enabled || !settings.notifications.withFilters}
options={followedChannels.map((follow) => ({
options={sortedFollowedChannels.map((follow) => ({
title: <ChannelName login={follow.broadcasterLogin} name={follow.broadcasterName} />,
value: follow.broadcasterId,
}))}
Expand Down

0 comments on commit 6542456

Please sign in to comment.