Skip to content

Commit 9bf46f6

Browse files
committed
fix: resolves conflicting id in tag select
1 parent 6c6a8d7 commit 9bf46f6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

app/assets/v2/js/grants/_new.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,19 +483,21 @@ if (document.getElementById('gc-new-grant')) {
483483
},
484484
grantTagOptions() {
485485
const all_tags = this.grant_tags.sort((a, b) => b.is_eligibility_tag - a.is_eligibility_tag);
486+
const sorted_tags = this.grant_tags.sort((a, b) => a.id - b.id);
486487
const first_discovery = (tag) => tag.is_eligibility_tag === 0;
487488

488489
all_tags.unshift({
489490
id: 0,
490491
name: 'eligibility tags'.toUpperCase(),
491492
is_eligibility_tag: 'label'
492493
});
493-
494+
494495
all_tags.splice(all_tags.findIndex(first_discovery), 0, {
495-
id: all_tags.length + 1,
496+
id: sorted_tags[sorted_tags.length-1].id + 1,
496497
name: 'discovery tags'.toUpperCase(),
497498
is_eligibility_tag: 'label'
498499
});
500+
499501
return all_tags;
500502
},
501503
queryParams() {

0 commit comments

Comments
 (0)