mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: sort order across the app
discussed with Nicolae and Nuno
This commit is contained in:
		
							parent
							
								
									1d8c286c79
								
							
						
					
					
						commit
						349106a2be
					
				@ -55,7 +55,7 @@ export const ReportTable = ({ projectId, features }: IReportTableProps) => {
 | 
			
		||||
    const initialState = useMemo(
 | 
			
		||||
        () => ({
 | 
			
		||||
            hiddenColumns: [],
 | 
			
		||||
            sortBy: [{ id: 'createdAt', desc: true }],
 | 
			
		||||
            sortBy: [{ id: 'createdAt' }],
 | 
			
		||||
        }),
 | 
			
		||||
        []
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
@ -119,6 +119,7 @@ const UsersList = () => {
 | 
			
		||||
                Cell: DateCell,
 | 
			
		||||
                disableGlobalFilter: true,
 | 
			
		||||
                sortType: 'date',
 | 
			
		||||
                minWidth: 120,
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                Header: 'Avatar',
 | 
			
		||||
@ -169,6 +170,7 @@ const UsersList = () => {
 | 
			
		||||
                ),
 | 
			
		||||
                disableGlobalFilter: true,
 | 
			
		||||
                sortType: 'date',
 | 
			
		||||
                minWidth: 150,
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                Header: 'Actions',
 | 
			
		||||
@ -193,7 +195,7 @@ const UsersList = () => {
 | 
			
		||||
 | 
			
		||||
    const initialState = useMemo(() => {
 | 
			
		||||
        return {
 | 
			
		||||
            sortBy: [{ id: 'createdAt', desc: false }],
 | 
			
		||||
            sortBy: [{ id: 'createdAt' }],
 | 
			
		||||
            hiddenColumns: isBillingUsers ? [] : ['type'],
 | 
			
		||||
        };
 | 
			
		||||
    }, [isBillingUsers]);
 | 
			
		||||
 | 
			
		||||
@ -99,7 +99,7 @@ const columns = [
 | 
			
		||||
    },
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
const defaultSort: SortingRule<string> = { id: 'createdAt', desc: true };
 | 
			
		||||
const defaultSort: SortingRule<string> = { id: 'createdAt' };
 | 
			
		||||
 | 
			
		||||
const { value: storedParams, setValue: setStoredParams } = createLocalStorage(
 | 
			
		||||
    'FeatureToggleListTable:v1',
 | 
			
		||||
 | 
			
		||||
@ -20,10 +20,7 @@ export const FeatureMetricsTable = ({
 | 
			
		||||
}: IFeatureMetricsTableProps) => {
 | 
			
		||||
    const isMediumScreen = useMediaQuery(theme.breakpoints.down('md'));
 | 
			
		||||
 | 
			
		||||
    const initialState = useMemo(
 | 
			
		||||
        () => ({ sortBy: [{ id: 'timestamp', desc: true }] }),
 | 
			
		||||
        []
 | 
			
		||||
    );
 | 
			
		||||
    const initialState = useMemo(() => ({ sortBy: [{ id: 'timestamp' }] }), []);
 | 
			
		||||
 | 
			
		||||
    const {
 | 
			
		||||
        getTableProps,
 | 
			
		||||
 | 
			
		||||
@ -67,10 +67,7 @@ const staticColumns = ['Actions', 'name'];
 | 
			
		||||
 | 
			
		||||
const defaultSort: SortingRule<string> & {
 | 
			
		||||
    columns?: string[];
 | 
			
		||||
} = {
 | 
			
		||||
    id: 'createdAt',
 | 
			
		||||
    desc: true,
 | 
			
		||||
};
 | 
			
		||||
} = { id: 'createdAt' };
 | 
			
		||||
 | 
			
		||||
export const ProjectFeatureToggles = ({
 | 
			
		||||
    features,
 | 
			
		||||
 | 
			
		||||
@ -30,7 +30,7 @@ export const SegmentTable = () => {
 | 
			
		||||
    const { segments, loading } = useSegments();
 | 
			
		||||
    const isSmallScreen = useMediaQuery(theme.breakpoints.down('md'));
 | 
			
		||||
    const [initialState] = useState({
 | 
			
		||||
        sortBy: [{ id: 'createdAt', desc: false }],
 | 
			
		||||
        sortBy: [{ id: 'createdAt' }],
 | 
			
		||||
        hiddenColumns: ['description'],
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -7,7 +7,7 @@ export const sortTypes = {
 | 
			
		||||
    date: (v1: any, v2: any, id: string) => {
 | 
			
		||||
        const a = new Date(v1?.values?.[id] || 0);
 | 
			
		||||
        const b = new Date(v2?.values?.[id] || 0);
 | 
			
		||||
        return a?.getTime() - b?.getTime();
 | 
			
		||||
        return b?.getTime() - a?.getTime(); // newest first by default
 | 
			
		||||
    },
 | 
			
		||||
    boolean: (v1: any, v2: any, id: string) => {
 | 
			
		||||
        const a = v1?.values?.[id];
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user