Skip to content

Commit

Permalink
feat: Sort behaviors by label (#75)
Browse files Browse the repository at this point in the history
* Make it a bit easier to select the behavior you want by sorting
  the list alphabetically by the label.
  • Loading branch information
petejohanson authored Nov 11, 2024
1 parent fe00c9f commit a996e4e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/behaviors/BehaviorBindingPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ export const BehaviorBindingPicker = ({
[behaviorId, behaviors]
);

const sortedBehaviors = useMemo(
() => behaviors.sort((a, b) => a.displayName.localeCompare(b.displayName)),
[behaviors]
);

useEffect(() => {
if (
binding.behaviorId === behaviorId &&
Expand Down Expand Up @@ -106,7 +111,7 @@ export const BehaviorBindingPicker = ({
setParam2(0);
}}
>
{behaviors.map((b) => (
{sortedBehaviors.map((b) => (
<option key={b.id} value={b.id}>
{b.displayName}
</option>
Expand Down

0 comments on commit a996e4e

Please sign in to comment.