Skip to content

Commit 44c5789

Browse files
authored
Fix: remote instance path (#739)
1 parent d49ae90 commit 44c5789

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

mwdb/web/src/commons/remotes/index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
import { useMatch } from "react-router-dom";
1+
import { useLocation, matchPath } from "react-router-dom";
22

33
export function useRemote() {
44
// Returns current remote name or undefined if current view is local
5-
const match = useMatch("/remote/:remote");
6-
return match && match.params.remote;
5+
const location = useLocation();
6+
const remotePath = matchPath(
7+
{ path: "/remote/:remote", end: false },
8+
location.pathname
9+
);
10+
return remotePath && remotePath.params.remote;
711
}
812

913
export function useRemotePath() {

0 commit comments

Comments
 (0)