File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed
Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 3333 },
3434 "dependencies" : {
3535 "prop-types" : " 15.x.x" ,
36- "router-async" : " 0.5.x"
36+ "router-async" : " 0.5.x" ,
37+ "serialize-javascript" : " ^1.4.0"
3738 }
3839}
Original file line number Diff line number Diff line change 11import * as React from 'react' ;
22import * as PropTypes from 'prop-types' ;
33import Router , { initParams , initResult } from './router' ;
4+ import serialize from 'serialize-javascript' ;
45
56export default class ServerRouter extends Router {
67 static async init ( opts : initParams ) : Promise < initResult > {
@@ -22,9 +23,9 @@ export default class ServerRouter extends Router {
2223 return (
2324 < div >
2425 { this . props . children ? this . props . children : < this . state . Component { ...this . state . componentProps } /> }
25- < script dangerouslySetInnerHTML = { { __html : `window.__REACT_ROUTER_ASYNC__=${ JSON . stringify ( {
26+ < script dangerouslySetInnerHTML = { { __html : `window.__REACT_ROUTER_ASYNC__=${ serialize ( {
2627 state : this . state
27- } ) } ;`} } />
28+ } , { isJSON : true } ) } ;`} } />
2829 </ div >
2930 )
3031 }
Original file line number Diff line number Diff line change 100100 path-to-regexp "^1.7.0"
101101 query-string "^4.3.2"
102102
103+ serialize-javascript@^1.4.0 :
104+ version "1.4.0"
105+ resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-1.4.0.tgz#7c958514db6ac2443a8abc062dc9f7886a7f6005"
106+
103107setimmediate@^1.0.5 :
104108 version "1.0.5"
105109 resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285"
You can’t perform that action at this time.
0 commit comments