diff --git a/opentech/static_src/src/app/src/components/GroupedListing/index.js b/opentech/static_src/src/app/src/components/GroupedListing/index.js index 28378b34c6eb0e78a303cb3a5238513be74db1d3..8688306d702d986bb63814b109b0feb18cc1267b 100644 --- a/opentech/static_src/src/app/src/components/GroupedListing/index.js +++ b/opentech/static_src/src/app/src/components/GroupedListing/index.js @@ -19,7 +19,9 @@ export default class GroupedListing extends React.Component { order: PropTypes.arrayOf(PropTypes.shape({ key: PropTypes.string.isRequired, display: PropTypes.string.isRequired, - values: PropTypes.arrayOf(PropTypes.number), + values: PropTypes.arrayOf( + PropTypes.oneOf(PropTypes.number, PropTypes.string), + ) })), onItemSelection: PropTypes.func, shouldSelectFirst: PropTypes.bool, @@ -47,7 +49,7 @@ export default class GroupedListing extends React.Component { componentDidUpdate(prevProps, prevState) { // Order items - if (this.props.items !== prevProps.items) { + if (this.props.items !== prevProps.items || this.props.order !== prevProps.order) { this.orderItems(); } diff --git a/opentech/static_src/src/app/src/containers/ByStatusListing.js b/opentech/static_src/src/app/src/containers/ByStatusListing.js index 01bfd1dbbdd13ec6d2fc62298052d612f486f561..99c565d6fbf279cc5e85ea84a652bc09e44d1269 100644 --- a/opentech/static_src/src/app/src/containers/ByStatusListing.js +++ b/opentech/static_src/src/app/src/containers/ByStatusListing.js @@ -57,11 +57,11 @@ class ByStatusListing extends React.Component { const slugify = value => value.toLowerCase().replace(/\s/g, '-') const workflow = round.workflow const order = workflow.reduce((accumulator, {display, value}, idx) => { - const key = slugify(display); + const key = slugify(value); const existing = accumulator[key] || {} const existingValues = existing.values || [] const position = existing.position || idx - accumulator[key] = {key, display, position, values: [...existingValues, parseInt(value)]} + accumulator[key] = {key, display, position, values: [...existingValues, value]} return accumulator }, {}) const arrayOrder = Object.values(order).sort((a,b) => a.position - b.position)