@umijs/renderer-react
Advanced tools
Comparing version 3.0.0-beta.10 to 3.0.0-beta.11
@@ -228,4 +228,4 @@ import * as ReactDOM from 'react-dom'; | ||
function wrapInitialPropsFetch(WrappedComponent) { | ||
return function Foo(props) { | ||
function wrapInitialPropsFetch(Component) { | ||
return function ComponentWithInitialPropsFetch(props) { | ||
var _useState = useState(), | ||
@@ -246,3 +246,3 @@ _useState2 = _slicedToArray(_useState, 2), | ||
_context.next = 2; | ||
return WrappedComponent.getInitialProps(); | ||
return Component.getInitialProps(); | ||
@@ -261,4 +261,10 @@ case 2: | ||
}, []); | ||
return React.createElement(WrappedComponent, _extends({}, props, initialProps)); | ||
return React.createElement(Component, _extends({}, props, initialProps)); | ||
}; | ||
} | ||
function wrapWrapper(Component, Wrapper) { | ||
return function (props) { | ||
return React.createElement(Wrapper, props, React.createElement(Component, props)); | ||
}; | ||
} // TODO: custom Switch | ||
@@ -276,3 +282,3 @@ // 1. keep alive | ||
var Component = route.component, | ||
Routes = route.Routes; | ||
wrappers = route.wrappers; | ||
@@ -282,2 +288,12 @@ if (Component) { | ||
Component = wrapInitialPropsFetch(Component); | ||
} // route.wrappers | ||
if (wrappers) { | ||
var len = wrappers.length - 1; | ||
while (len >= 0) { | ||
Component = wrapWrapper(Component, wrappers[len]); | ||
len -= 1; | ||
} | ||
} | ||
@@ -284,0 +300,0 @@ |
@@ -235,4 +235,4 @@ 'use strict'; | ||
function wrapInitialPropsFetch(WrappedComponent) { | ||
return function Foo(props) { | ||
function wrapInitialPropsFetch(Component) { | ||
return function ComponentWithInitialPropsFetch(props) { | ||
var _useState = React.useState(), | ||
@@ -253,3 +253,3 @@ _useState2 = _slicedToArray(_useState, 2), | ||
_context.next = 2; | ||
return WrappedComponent.getInitialProps(); | ||
return Component.getInitialProps(); | ||
@@ -268,4 +268,10 @@ case 2: | ||
}, []); | ||
return React__default.createElement(WrappedComponent, _extends({}, props, initialProps)); | ||
return React__default.createElement(Component, _extends({}, props, initialProps)); | ||
}; | ||
} | ||
function wrapWrapper(Component, Wrapper) { | ||
return function (props) { | ||
return React__default.createElement(Wrapper, props, React__default.createElement(Component, props)); | ||
}; | ||
} // TODO: custom Switch | ||
@@ -283,3 +289,3 @@ // 1. keep alive | ||
var Component = route.component, | ||
Routes = route.Routes; | ||
wrappers = route.wrappers; | ||
@@ -289,2 +295,12 @@ if (Component) { | ||
Component = wrapInitialPropsFetch(Component); | ||
} // route.wrappers | ||
if (wrappers) { | ||
var len = wrappers.length - 1; | ||
while (len >= 0) { | ||
Component = wrapWrapper(Component, wrappers[len]); | ||
len -= 1; | ||
} | ||
} | ||
@@ -291,0 +307,0 @@ |
{ | ||
"name": "@umijs/renderer-react", | ||
"version": "3.0.0-beta.10", | ||
"version": "3.0.0-beta.11", | ||
"description": "@umijs/renderer-react", | ||
@@ -30,3 +30,3 @@ "main": "dist/index.js", | ||
"@types/react-dom": "^16.9.4", | ||
"@umijs/runtime": "3.0.0-beta.10", | ||
"@umijs/runtime": "3.0.0-beta.11", | ||
"react": "^16.12.0", | ||
@@ -33,0 +33,0 @@ "react-dom": "^16.12.0" |
@@ -16,3 +16,3 @@ import { FunctionComponent } from 'react'; | ||
sensitive?: boolean; | ||
Routes?: any[]; | ||
wrappers?: any[]; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
36950
1230
+ Added@umijs/runtime@3.0.0-beta.11(transitive)
- Removed@umijs/runtime@3.0.0-beta.10(transitive)
Updated@umijs/runtime@3.0.0-beta.11