scripts were getting rendered to html twice, causing double init

This commit is contained in:
Aaron 2019-02-15 21:28:06 -06:00
parent 00dedfbfc0
commit f489b093f6
No known key found for this signature in database
GPG Key ID: 3B5B7597106F0A0E
2 changed files with 2 additions and 8 deletions

View File

@ -5,7 +5,6 @@ import { ChunkExtractor } from '@loadable/server';
export interface Props {
children: any;
css: string[];
scripts: string[];
linkTags: Array<React.LinkHTMLAttributes<HTMLLinkElement>>;
metaTags: Array<React.MetaHTMLAttributes<HTMLMetaElement>>;
state: string;
@ -15,7 +14,6 @@ export interface Props {
const HTML: React.SFC<Props> = ({
children,
scripts,
css,
state,
i18n,
@ -78,9 +76,9 @@ const HTML: React.SFC<Props> = ({
</head>
<body>
<div id="app" dangerouslySetInnerHTML={{ __html: children }} />
{scripts.map(src => {
{/* {scripts.map(src => {
return <script key={src} src={src} />;
})}
})} */}
</body>
</html>
);

View File

@ -53,9 +53,6 @@ const serverRenderer = async (req: Request, res: Response) => {
const cssFiles = ['bundle.css', 'vendor.css']
.map(f => res.locals.assetPath(f))
.filter(Boolean);
const jsFiles = ['vendor.js', 'bundle.js']
.map(f => res.locals.assetPath(f))
.filter(Boolean);
const mappedLinkTags = linkTags
.map(l => ({ ...l, href: res.locals.assetPath(l.href) }))
.filter(l => !!l.href);
@ -66,7 +63,6 @@ const serverRenderer = async (req: Request, res: Response) => {
const html = renderToString(
<Html
css={cssFiles}
scripts={jsFiles}
linkTags={mappedLinkTags}
metaTags={mappedMetaTags}
state={state}