Skip to content

Commit

Permalink
feat(Topics): add sort URL param to topic pages.
Browse files Browse the repository at this point in the history
This will track the sort option on topic pages which can be either "Relevance" or "Chronological".
  • Loading branch information
nsantacruz committed Sep 6, 2023
1 parent 7602cfa commit b4a5645
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions static/js/Misc.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -364,11 +364,12 @@ const FilterableList = ({
filterFunc, sortFunc, renderItem, sortOptions, getData, data, renderEmptyList,
renderHeader, renderFooter, showFilterHeader, refreshData, initialFilter,
scrollableElement, pageSize, onDisplayedDataChange, initialRenderSize,
bottomMargin, containerClass, onSetSort, initialSort,
bottomMargin, containerClass, onSetSort, externalSortOption,
}) => {
const [filter, setFilter] = useState(initialFilter || '');
const [sortOption, setSortOption] = useState(initialSort || sortOptions[0]);
const [internalSortOption, setSortOption] = useState(externalSortOption || sortOptions[0]);
const [displaySort, setDisplaySort] = useState(false);
const sortOption = externalSortOption || internalSortOption;

// Apply filter and sort to the raw data
const processData = rawData => rawData ? rawData
Expand Down
2 changes: 1 addition & 1 deletion static/js/TopicPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ const TopicPageTab = ({
onDisplayedDataChange={onDisplayedDataChange}
initialRenderSize={initialRenderSize}
onSetSort={onSetTopicSort}
initialSort={topicSort}
externalSortOption={topicSort}
data={data}
/>
</div> : <LoadingMessage />
Expand Down

0 comments on commit b4a5645

Please sign in to comment.