New useNavigateApp (#9729)
Todo : - replace all instances of useNavigate( - remove getSettingsPagePath - add eslint rule to enfore usage of useNavigateApp instead of useNavigate
This commit is contained in:
@ -9,6 +9,7 @@ import { View } from '@/views/types/View';
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { getAppPath } from '~/utils/navigation/getAppPath';
|
||||
|
||||
export const useDefaultHomePagePath = () => {
|
||||
const currentUser = useRecoilValue(currentUserState);
|
||||
@ -79,11 +80,13 @@ export const useDefaultHomePagePath = () => {
|
||||
}
|
||||
|
||||
const namePlural = defaultObjectPathInfo.objectMetadataItem?.namePlural;
|
||||
const viewParam = defaultObjectPathInfo.view
|
||||
? `?view=${defaultObjectPathInfo.view.id}`
|
||||
: '';
|
||||
const viewId = defaultObjectPathInfo.view?.id;
|
||||
|
||||
return `/objects/${namePlural}${viewParam}`;
|
||||
return getAppPath(
|
||||
AppPath.RecordIndexPage,
|
||||
{ objectNamePlural: namePlural },
|
||||
viewId ? { viewId } : undefined,
|
||||
);
|
||||
}, [currentUser, defaultObjectPathInfo]);
|
||||
|
||||
return { defaultHomePagePath };
|
||||
|
||||
Reference in New Issue
Block a user