Skip to content

Commit

Permalink
chore(clerk-js): Apply changes to PathRouter for retheme directory
Browse files Browse the repository at this point in the history
  • Loading branch information
desiprisg authored and dimkl committed Nov 28, 2023
1 parent af56f51 commit b782ad2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .changeset/soft-swans-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
7 changes: 4 additions & 3 deletions packages/clerk-js/src/ui.retheme/router/PathRouter.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { NavigateOptions } from '@clerk/types';
import React from 'react';

import { hasUrlInFragment, mergeFragmentIntoUrl, stripOrigin } from '../../utils';
Expand All @@ -18,12 +19,12 @@ export const PathRouter = ({ basePath, preservedParams, children }: PathRouterPr
throw new Error('Clerk: Missing navigate option.');
}

const internalNavigate = (toURL: URL | string | undefined) => {
const internalNavigate = (toURL: URL | string | undefined, options?: NavigateOptions) => {
if (!toURL) {
return;
}
// Only send the path
return navigate(stripOrigin(toURL));
return navigate(stripOrigin(toURL), options);
};

const getPath = () => {
Expand All @@ -38,7 +39,7 @@ export const PathRouter = ({ basePath, preservedParams, children }: PathRouterPr
const convertHashToPath = async () => {
if (hasUrlInFragment(window.location.hash)) {
const url = mergeFragmentIntoUrl(new URL(window.location.href));
await internalNavigate(url.href);
await internalNavigate(url.href, { replace: true });
setStripped(true);
}
};
Expand Down

0 comments on commit b782ad2

Please sign in to comment.