@umijs/renderer-react 4.0.79 → 4.0.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,23 +9,18 @@ export function useAppData() {
9
9
  }
10
10
  export function useSelectedRoutes() {
11
11
  var location = useLocation();
12
-
13
12
  var _useAppData = useAppData(),
14
- clientRoutes = _useAppData.clientRoutes; // use `useLocation` get location without `basename`, not need `basename` param
15
-
16
-
13
+ clientRoutes = _useAppData.clientRoutes;
14
+ // use `useLocation` get location without `basename`, not need `basename` param
17
15
  var routes = matchRoutes(clientRoutes, location.pathname);
18
16
  return routes || [];
19
17
  }
20
18
  export function useRouteProps() {
21
19
  var _currentRoute$;
22
-
23
20
  var currentRoute = useSelectedRoutes().slice(-1);
24
-
25
21
  var _ref = ((_currentRoute$ = currentRoute[0]) === null || _currentRoute$ === void 0 ? void 0 : _currentRoute$.route) || {},
26
- _ = _ref.element,
27
- props = _objectWithoutProperties(_ref, _excluded);
28
-
22
+ _ = _ref.element,
23
+ props = _objectWithoutProperties(_ref, _excluded);
29
24
  return props;
30
25
  }
31
26
  export function useServerLoaderData() {
package/dist/link.js CHANGED
@@ -6,19 +6,16 @@ import { Link } from 'react-router-dom';
6
6
  import { useAppData } from "./appContext";
7
7
  export function LinkWithPrefetch(props) {
8
8
  var _props$to;
9
-
10
9
  var prefetch = props.prefetch,
11
- linkProps = _objectWithoutProperties(props, _excluded);
12
-
10
+ linkProps = _objectWithoutProperties(props, _excluded);
13
11
  var appData = useAppData();
14
- var to = typeof props.to === 'string' ? props.to : (_props$to = props.to) === null || _props$to === void 0 ? void 0 : _props$to.pathname; // compatible with old code
12
+ var to = typeof props.to === 'string' ? props.to : (_props$to = props.to) === null || _props$to === void 0 ? void 0 : _props$to.pathname;
13
+ // compatible with old code
15
14
  // which to might be undefined
16
-
17
15
  if (!to) return null;
18
16
  return /*#__PURE__*/React.createElement(Link, _extends({
19
17
  onMouseEnter: function onMouseEnter() {
20
18
  var _appData$preloadRoute;
21
-
22
19
  return prefetch && to && ((_appData$preloadRoute = appData.preloadRoute) === null || _appData$preloadRoute === void 0 ? void 0 : _appData$preloadRoute.call(appData, to));
23
20
  }
24
21
  }, linkProps), props.children);
@@ -2,8 +2,7 @@ import { useLocation } from 'react-router-dom';
2
2
  import { useAppData } from "./appContext";
3
3
  export function __useFetcher() {
4
4
  var _useAppData = useAppData(),
5
- preloadRoute = _useAppData.preloadRoute;
6
-
5
+ preloadRoute = _useAppData.preloadRoute;
7
6
  var location = useLocation();
8
7
  return {
9
8
  load: function load(path) {
@@ -37,6 +37,5 @@ export function withRouter(Component) {
37
37
  navigate: navigate
38
38
  }));
39
39
  }
40
-
41
40
  return ComponentWithRouterProp;
42
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/renderer-react",
3
- "version": "4.0.79",
3
+ "version": "4.0.81",
4
4
  "description": "@umijs/renderer-react",
5
5
  "homepage": "https://github.com/umijs/umi/tree/master/packages/renderer-react#readme",
6
6
  "bugs": "https://github.com/umijs/umi/issues",