Skip to content

Commit a996e4e

Browse files
authored
feat: Sort behaviors by label (#75)
* Make it a bit easier to select the behavior you want by sorting the list alphabetically by the label.
1 parent fe00c9f commit a996e4e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/behaviors/BehaviorBindingPicker.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ export const BehaviorBindingPicker = ({
5454
[behaviorId, behaviors]
5555
);
5656

57+
const sortedBehaviors = useMemo(
58+
() => behaviors.sort((a, b) => a.displayName.localeCompare(b.displayName)),
59+
[behaviors]
60+
);
61+
5762
useEffect(() => {
5863
if (
5964
binding.behaviorId === behaviorId &&
@@ -106,7 +111,7 @@ export const BehaviorBindingPicker = ({
106111
setParam2(0);
107112
}}
108113
>
109-
{behaviors.map((b) => (
114+
{sortedBehaviors.map((b) => (
110115
<option key={b.id} value={b.id}>
111116
{b.displayName}
112117
</option>

0 commit comments

Comments
 (0)