Skip to content

Commit

Permalink
Merge pull request #494 from oskarhane/3.0-sort-meta-items
Browse files Browse the repository at this point in the history
Sort meta items alphabetically when fetched
  • Loading branch information
irfannuri authored May 8, 2017
2 parents 35c4af6 + 7e68094 commit 93ace92
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/shared/modules/dbMeta/dbMetaDuck.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,23 @@ function updateMetaForContext (state, meta, context) {
}
}

const compareMetaItems = (a, b) => a.val < b.val ? -1 : (a.val > b.val ? 1 : 0)

const labels = state
.labels
.filter(notInCurrentContext)
.concat(mapResult(0, mapSingleValue))
.sort(compareMetaItems)
const relationshipTypes = state
.relationshipTypes
.filter(notInCurrentContext)
.concat(mapResult(1, mapSingleValue))
.sort(compareMetaItems)
const properties = state
.properties
.filter(notInCurrentContext)
.concat(mapResult(2, mapSingleValue))
.sort(compareMetaItems)
const functions = state
.functions
.filter(notInCurrentContext)
Expand Down

0 comments on commit 93ace92

Please sign in to comment.