Skip to content

Commit

Permalink
Fix [Feature sets] add sorting by updated date to expanded rows (#3161)
Browse files Browse the repository at this point in the history
  • Loading branch information
Taras-Hlukhovetskyi authored Mar 7, 2025
1 parent 33664ef commit c34575e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/FeatureStore/FeatureSets/FeatureSets.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ const FeatureSets = () => {
)
.unwrap()
.then(result => {
const content = [...parseFeatureSets(result)].map(contentItem =>
const content = sortListByDate(parseFeatureSets(result), 'updated', false).map(contentItem =>
createFeatureSetsRowData(contentItem, params.projectName, FEATURE_SETS_TAB, true)
)
setSelectedRowData(state => ({
Expand Down
2 changes: 1 addition & 1 deletion src/utils/datetime.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const getDateAndTimeByFormat = (date, dateFormat) => {
return moment(date).format(dateFormat)
}

export const sortListByDate = (list, field, isAscending = true) => {
export const sortListByDate = (list = [], field, isAscending = true) => {
return [...list].sort((prevElem, nextElem) => {
const prev = Date.parse(prevElem[field])
const next = Date.parse(nextElem[field])
Expand Down
1 change: 1 addition & 0 deletions src/utils/parseFeatures.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const parseFeatures = (featuresResp, filterByFeatureSetName) => {

return {
...item,
updated: item.metadata?.updated, // added updated property from feature_set_digest for correct grouping to get correct last items
ui: {
...item.ui,
identifier: getFeatureIdentifier(item),
Expand Down

0 comments on commit c34575e

Please sign in to comment.