From 0fd5823c1dbc7804feba51875aec97fe8bd99dae Mon Sep 17 00:00:00 2001 From: StringEpsilon Date: Sat, 18 Jul 2020 16:22:46 +0200 Subject: [PATCH] createPath: Prefix search and hash parts as needed. Fixes #813. --- packages/history/index.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/history/index.ts b/packages/history/index.ts index 4c83f7e5c..8e4905873 100644 --- a/packages/history/index.ts +++ b/packages/history/index.ts @@ -1080,6 +1080,12 @@ export function createPath({ search = '', hash = '' }: PartialPath) { + if (search && search[0] !== '?'){ + search = '?' + search; + } + if (hash && hash[0] !== '#'){ + hash = '#' + hash; + } return pathname + search + hash; }