diff --git a/.changeset/brave-snails-sort.md b/.changeset/brave-snails-sort.md new file mode 100644 index 0000000..35bacb3 --- /dev/null +++ b/.changeset/brave-snails-sort.md @@ -0,0 +1,5 @@ +--- +"@hydrofoil/shell-routing": patch +--- + +Preserve hash fragment when routing changes diff --git a/packages/routing/index.ts b/packages/routing/index.ts index 237e9cb..6698498 100644 --- a/packages/routing/index.ts +++ b/packages/routing/index.ts @@ -25,7 +25,7 @@ export const routing = ({ appPath = '/', pathPrefix = '' }: Options = {}) => { const path = resourceUrl.pathname.replace(prefixPattern, '') if (url.hostname === resourceUrl.hostname) { - return `${appPath}${path}${resourceUrl.search}` + return `${appPath}${path}${resourceUrl.search}${resourceUrl.hash}` } return `${appPath}/${href}` }