@umijs/renderer-react 4.1.8 → 4.1.9

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.
Files changed (2) hide show
  1. package/dist/routes.js +10 -3
  2. package/package.json +1 -1
package/dist/routes.js CHANGED
@@ -4,9 +4,9 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
4
  var _excluded = ["redirect"];
5
5
  // @ts-ignore
6
6
  import React from 'react';
7
- import { generatePath, Navigate, useParams, Outlet } from 'react-router-dom';
7
+ import { generatePath, Navigate, Outlet, useLocation, useParams } from 'react-router-dom';
8
+ import { useAppData, useRouteProps } from "./appContext";
8
9
  import { RouteContext, useRouteData } from "./routeContext";
9
- import { useAppData } from "./appContext";
10
10
  export function createClientRoutes(opts) {
11
11
  var routesById = opts.routesById,
12
12
  parentId = opts.parentId,
@@ -43,8 +43,15 @@ export function createClientRoutes(opts) {
43
43
  }
44
44
  function NavigateWithParams(props) {
45
45
  var params = useParams();
46
+ var to = generatePath(props.to, params);
47
+ var routeProps = useRouteProps();
48
+ var location = useLocation();
49
+ if (routeProps !== null && routeProps !== void 0 && routeProps.keepQuery) {
50
+ var queryAndHash = location.search + location.hash;
51
+ to += queryAndHash;
52
+ }
46
53
  var propsWithParams = _objectSpread(_objectSpread({}, props), {}, {
47
- to: generatePath(props.to, params)
54
+ to: to
48
55
  });
49
56
  return /*#__PURE__*/React.createElement(Navigate, _extends({
50
57
  replace: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/renderer-react",
3
- "version": "4.1.8",
3
+ "version": "4.1.9",
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",