We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d49ae90 commit 44c5789Copy full SHA for 44c5789
mwdb/web/src/commons/remotes/index.js
@@ -1,9 +1,13 @@
1
-import { useMatch } from "react-router-dom";
+import { useLocation, matchPath } from "react-router-dom";
2
3
export function useRemote() {
4
// Returns current remote name or undefined if current view is local
5
- const match = useMatch("/remote/:remote");
6
- return match && match.params.remote;
+ const location = useLocation();
+ const remotePath = matchPath(
7
+ { path: "/remote/:remote", end: false },
8
+ location.pathname
9
+ );
10
+ return remotePath && remotePath.params.remote;
11
}
12
13
export function useRemotePath() {
0 commit comments