fix(settings routing): handle trailing slashes in base paths (#10055)
Adjusted URL construction to properly handle trailing slashes in base paths, ensuring consistent matching logic. Added logic for setting the hotkey scope when navigating to the domain settings path.
This commit is contained in:
@ -24,7 +24,7 @@ export const useApolloFactory = (options: Partial<Options<any>> = {}) => {
|
||||
const [isDebugMode] = useRecoilState(isDebugModeState);
|
||||
|
||||
const navigate = useNavigate();
|
||||
const isMatchingLocation = useIsMatchingLocation();
|
||||
const { isMatchingLocation } = useIsMatchingLocation();
|
||||
const [tokenPair, setTokenPair] = useRecoilState(tokenPairState);
|
||||
const [currentWorkspace, setCurrentWorkspace] = useRecoilState(
|
||||
currentWorkspaceState,
|
||||
|
||||
@ -29,7 +29,7 @@ import { usePageChangeEffectNavigateLocation } from '~/hooks/usePageChangeEffect
|
||||
// - moved usePageChangeEffectNavigateLocation into dedicated hook
|
||||
export const PageChangeEffect = () => {
|
||||
const navigate = useNavigate();
|
||||
const isMatchingLocation = useIsMatchingLocation();
|
||||
const { isMatchingLocation } = useIsMatchingLocation();
|
||||
|
||||
const [previousLocation, setPreviousLocation] = useState('');
|
||||
|
||||
@ -140,6 +140,13 @@ export const PageChangeEffect = () => {
|
||||
});
|
||||
break;
|
||||
}
|
||||
case isMatchingLocation(SettingsPath.Domain, AppBasePath.Settings): {
|
||||
setHotkeyScope(PageHotkeyScope.Settings, {
|
||||
goto: false,
|
||||
keyboardShortcutMenu: true,
|
||||
});
|
||||
break;
|
||||
}
|
||||
case isMatchingLocation(
|
||||
SettingsPath.WorkspaceMembersPage,
|
||||
AppBasePath.Settings,
|
||||
|
||||
@ -24,7 +24,7 @@ export const useSignInUp = (form: UseFormReturn<Form>) => {
|
||||
const [signInUpStep, setSignInUpStep] = useRecoilState(signInUpStepState);
|
||||
const [signInUpMode, setSignInUpMode] = useRecoilState(signInUpModeState);
|
||||
|
||||
const isMatchingLocation = useIsMatchingLocation();
|
||||
const { isMatchingLocation } = useIsMatchingLocation();
|
||||
|
||||
const workspaceInviteHash = useParams().workspaceInviteHash;
|
||||
const [searchParams] = useSearchParams();
|
||||
|
||||
@ -34,9 +34,9 @@ jest.mock('~/hooks/useIsMatchingLocation');
|
||||
const mockUseIsMatchingLocation = jest.mocked(useIsMatchingLocation);
|
||||
|
||||
const setupMockIsMatchingLocation = (pathname: string) => {
|
||||
mockUseIsMatchingLocation.mockReturnValueOnce(
|
||||
(path: string) => path === pathname,
|
||||
);
|
||||
mockUseIsMatchingLocation.mockReturnValueOnce({
|
||||
isMatchingLocation: (path: string) => path === pathname,
|
||||
});
|
||||
};
|
||||
|
||||
const getResult = (isDefaultLayoutAuthModalVisible = true) =>
|
||||
|
||||
@ -11,7 +11,7 @@ import { OnboardingStatus, SubscriptionStatus } from '~/generated/graphql';
|
||||
import { useIsMatchingLocation } from '~/hooks/useIsMatchingLocation';
|
||||
|
||||
export const useShowAuthModal = () => {
|
||||
const isMatchingLocation = useIsMatchingLocation();
|
||||
const { isMatchingLocation } = useIsMatchingLocation();
|
||||
const isLoggedIn = useIsLogged();
|
||||
const onboardingStatus = useOnboardingStatus();
|
||||
const subscriptionStatus = useSubscriptionStatus();
|
||||
|
||||
@ -10,7 +10,7 @@ import { UserOrMetadataLoader } from '~/loading/components/UserOrMetadataLoader'
|
||||
|
||||
export const UserProvider = ({ children }: React.PropsWithChildren) => {
|
||||
const isCurrentUserLoaded = useRecoilValue(isCurrentUserLoadedState);
|
||||
const isMatchingLocation = useIsMatchingLocation();
|
||||
const { isMatchingLocation } = useIsMatchingLocation();
|
||||
|
||||
const dateTimeFormat = useRecoilValue(dateTimeFormatState);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user