@umijs/renderer-react 4.0.24 → 4.0.25
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.
- package/dist/link.js +7 -2
- package/package.json +1 -1
package/dist/link.js
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["prefetch"];
|
|
2
4
|
import React from 'react';
|
|
3
5
|
import { Link } from 'react-router-dom';
|
|
4
6
|
import { useAppData } from "./appContext";
|
|
5
7
|
export function LinkWithPrefetch(props) {
|
|
8
|
+
var prefetch = props.prefetch,
|
|
9
|
+
linkProps = _objectWithoutProperties(props, _excluded);
|
|
10
|
+
|
|
6
11
|
var appData = useAppData();
|
|
7
12
|
var to = typeof props.to === 'string' ? props.to : props.to.pathname;
|
|
8
13
|
return /*#__PURE__*/React.createElement(Link, _extends({
|
|
9
14
|
onMouseEnter: function onMouseEnter() {
|
|
10
15
|
var _appData$preloadRoute;
|
|
11
16
|
|
|
12
|
-
return
|
|
17
|
+
return prefetch && to && ((_appData$preloadRoute = appData.preloadRoute) === null || _appData$preloadRoute === void 0 ? void 0 : _appData$preloadRoute.call(appData, to));
|
|
13
18
|
}
|
|
14
|
-
},
|
|
19
|
+
}, linkProps), props.children);
|
|
15
20
|
}
|
package/package.json
CHANGED