Skip to content

Commit 9498924

Browse files
authored
fix(replay) - useReplayTableSort now properly uses DEFAULT_SORT (#102882)
useReplayTableSort isn't using the `DEFAULT_SORT` table as it should be.
1 parent 200c06c commit 9498924

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

static/app/components/replays/table/useReplayTableSort.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {useCallback, useRef} from 'react';
1+
import {useCallback} from 'react';
22

33
import {trackAnalytics} from 'sentry/utils/analytics';
44
import {encodeSort} from 'sentry/utils/discover/eventView';
@@ -12,18 +12,17 @@ interface Props {
1212
queryParamKey?: string;
1313
}
1414

15-
const DEFAULT_SORT = {field: 'started_at', kind: 'asc'} as const;
15+
const DEFAULT_SORT = {field: 'started_at', kind: 'desc'} as const;
1616

1717
export default function useReplayTableSort({
1818
defaultSort = DEFAULT_SORT,
1919
queryParamKey = 'sort',
2020
}: Props = {}) {
21-
const defaultSortRef = useRef(defaultSort);
2221
const organization = useOrganization();
2322

24-
const {getParamValue, setParamValue} = useUrlParams(queryParamKey, '-started_at');
23+
const {getParamValue, setParamValue} = useUrlParams(queryParamKey, '');
2524
const sortQuery = getParamValue();
26-
const sortType = decodeSorts(sortQuery).at(0) ?? defaultSortRef.current;
25+
const sortType = decodeSorts(sortQuery).at(0) ?? defaultSort;
2726

2827
const handleSortClick = useCallback(
2928
(key: string) => {

0 commit comments

Comments
 (0)