@umijs/renderer-react 4.0.44 → 4.0.46
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.d.ts +1 -1
- package/dist/link.js +6 -1
- package/package.json +1 -1
package/dist/link.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import React, { PropsWithChildren } from 'react';
|
|
|
2
2
|
import { LinkProps } from 'react-router-dom';
|
|
3
3
|
export declare function LinkWithPrefetch(props: PropsWithChildren<{
|
|
4
4
|
prefetch?: boolean;
|
|
5
|
-
} & LinkProps & React.RefAttributes<HTMLAnchorElement>>): JSX.Element;
|
|
5
|
+
} & LinkProps & React.RefAttributes<HTMLAnchorElement>>): JSX.Element | null;
|
package/dist/link.js
CHANGED
|
@@ -5,11 +5,16 @@ import React from 'react';
|
|
|
5
5
|
import { Link } from 'react-router-dom';
|
|
6
6
|
import { useAppData } from "./appContext";
|
|
7
7
|
export function LinkWithPrefetch(props) {
|
|
8
|
+
var _props$to;
|
|
9
|
+
|
|
8
10
|
var prefetch = props.prefetch,
|
|
9
11
|
linkProps = _objectWithoutProperties(props, _excluded);
|
|
10
12
|
|
|
11
13
|
var appData = useAppData();
|
|
12
|
-
var to = typeof props.to === 'string' ? props.to : props.to.pathname;
|
|
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
|
|
15
|
+
// which to might be undefined
|
|
16
|
+
|
|
17
|
+
if (!to) return null;
|
|
13
18
|
return /*#__PURE__*/React.createElement(Link, _extends({
|
|
14
19
|
onMouseEnter: function onMouseEnter() {
|
|
15
20
|
var _appData$preloadRoute;
|
package/package.json
CHANGED