Skip to content

Commit cc4d238

Browse files
committed
Fix sorting for communities
Fix sorting for communities so the current community is at the top
1 parent 57cd000 commit cc4d238

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

builder/src/upload.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,12 @@ const SubmissionForm: React.FC<SubmissionFormProps> = observer((props) => {
269269

270270
promise.then((result) => {
271271
const next = current.concat(result.results);
272-
next.sort((a, b) =>
273-
a.identifier == props.currentCommunity.identifier
274-
? -1
275-
: a.name.localeCompare(b.name)
276-
);
272+
next.sort((a, b) => {
273+
if (a.identifier == props.currentCommunity.identifier)
274+
return -1;
275+
if (b.identifier == props.currentCommunity.identifier) return 1;
276+
return a.name.localeCompare(b.name);
277+
});
277278
setCommunities(next);
278279
if (result.pagination.next_link) {
279280
enumerateCommunities(next, result.pagination.next_link);

0 commit comments

Comments
 (0)