Skip to content

Commit

Permalink
[#181] Update default sorting to pubDate if exists (#706)
Browse files Browse the repository at this point in the history
Issue/Ticket
[Link](US-GHG-Center/veda-config-ghg#181)

Description
Updates the default sorting for stories from `name` to `pubDate`
  • Loading branch information
sandrahoang686 authored Oct 23, 2023
2 parents 1bb5c5e + 54fd72e commit 0a84a5e
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export function useBrowserControls({ sortOptions }: BrowseControlsHookParams) {
const [sortField, setSortField] = useQsState.memo(
{
key: Actions.SORT_FIELD,
default: sortOptions[0].id,
// If pubDate exists, default sorting to this
default: sortOptions.find((o) => o.id === 'pubDate')?.id || sortOptions[0]?.id,
validator: sortOptions.map((d) => d.id)
},
[sortOptions]
Expand Down

0 comments on commit 0a84a5e

Please sign in to comment.