File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
packages/smooth/src/router Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import React, {
6
6
useContext ,
7
7
useMemo ,
8
8
} from 'react'
9
+ import { createPath } from 'history'
9
10
import { Router , withRouter } from 'react-router-dom'
10
11
import HiddenHistoryContext from './HiddenHistoryContext'
11
12
@@ -15,6 +16,10 @@ export function useHiddenRouter() {
15
16
return useContext ( HiddenRouterContext )
16
17
}
17
18
19
+ function createURL ( location ) {
20
+ return typeof location === 'string' ? location : createPath ( location )
21
+ }
22
+
18
23
function HiddenRouter ( { history, children } ) {
19
24
const hiddenHistory = useContext ( HiddenHistoryContext )
20
25
const promises = useRef ( [ ] )
@@ -60,6 +65,7 @@ function HiddenRouter({ history, children }) {
60
65
goForward : noop ,
61
66
listen : ( ) => noop ,
62
67
block : ( ) => noop ,
68
+ createHref : path => createURL ( path ) ,
63
69
}
64
70
} , [ hiddenHistory . location ] )
65
71
You can’t perform that action at this time.
0 commit comments