Skip to content

Commit 81ef52f

Browse files
author
ahmetkuslular
committed
feat: If componentn is empty, html is returned empty
1 parent 079b253 commit 81ef52f

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "voltranjs",
3-
"version": "1.2.0-beta.7",
3+
"version": "1.2.0-beta.8",
44
"main": "src/index.js",
55
"author": "Hepsiburada Technology Team",
66
"bin": {

src/renderMultiple.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ async function setInitialStates(renderers) {
124124
const winner = getWinner(requests, hashes);
125125
incWinnerScore(winner, hashes);
126126
putWinnerMap(serviceName, renderer.winnerMap, winner);
127-
128127
if (!promises[winner.hash]) {
129128
promises[winner.hash] = callback => {
130129
winner

src/universal/components/App.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ class App extends PureComponent {
4747
const { isHydratingCompleted } = this.state;
4848
return (
4949
<ReactRenderContext.Provider value={isHydratingCompleted}>
50-
<div>
51-
<Switch>{renderRoutes(this.generateRoutingProps())}</Switch>
52-
</div>
50+
<Switch>{renderRoutes(this.generateRoutingProps())}</Switch>
5351
</ReactRenderContext.Provider>
5452
);
5553
}

src/universal/components/Html.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,17 @@ function Html({
3131
isMobileFragment,
3232
context
3333
}) {
34-
return `
34+
if (children) {
35+
return `
3536
<div>
3637
${styleTags}
3738
<script type='text/javascript'>${generateInitialState(initialState, componentName)}</script>
3839
<div
3940
id='${componentName.replace(/['"']+/g, '')}_${initialState.id}'
4041
style="pointer-events: none;"
4142
class="${voltranConfig.prefix}-voltran-body voltran-body ${
42-
isMobileFragment ? 'mobile' : ''
43-
}${fullWidth ? 'full' : ''} ${componentClassName(componentName, context)}">
43+
isMobileFragment ? 'mobile' : ''
44+
}${fullWidth ? 'full' : ''} ${componentClassName(componentName, context)}">
4445
${children}
4546
</div>
4647
<div>REPLACE_WITH_LINKS</div>
@@ -55,6 +56,9 @@ function Html({
5556
`<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0" />`
5657
)}
5758
</div>`;
59+
}
60+
61+
return '';
5862
}
5963

6064
export default Html;

src/universal/components/RequestDispatcher/RequestDispatcher.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useEffect } from 'react';
1+
import { useEffect } from 'react';
22

33
import withBaseComponent from '../../partials/withBaseComponent';
44
import { getEventBus } from '../../utils/helper';

0 commit comments

Comments
 (0)