Skip to content

Commit

Permalink
SSR: Enable server side rendering based on feature flag
Browse files Browse the repository at this point in the history
Enabled in all environments except stage and production.
  • Loading branch information
ehg committed Jan 15, 2016
1 parent 6aa352e commit 9a681b2
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions config/development.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"discover_blog_id": 53424024,
"features": {
"code-splitting": true,
"server-side-rendering": true,

"reader": true,
"reader/teams": true,
Expand Down
1 change: 1 addition & 0 deletions config/horizon.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"discover_blog_id": 53424024,
"features": {
"code-splitting": true,
"server-side-rendering": true,

"post-editor": true,
"post-editor/iframe-preview": true,
Expand Down
1 change: 1 addition & 0 deletions config/production.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"discover_blog_id": 53424024,
"features": {
"code-splitting": true,
"server-side-rendering": false,
"manage/ads": true,
"manage/ads/jetpack": true,
"manage/customize": true,
Expand Down
1 change: 1 addition & 0 deletions config/stage.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"discover_blog_id": 53424024,
"features": {
"code-splitting": true,
"server-side-rendering": false,
"post-editor": true,
"post-editor/iframe-preview": true,
"post-editor/live-image-updates": true,
Expand Down
1 change: 1 addition & 0 deletions config/wpcalypso.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"discover_blog_id": 53424024,
"features": {
"code-splitting": true,
"server-side-rendering": true,

"post-editor": true,
"post-editor/iframe-preview": true,
Expand Down
12 changes: 7 additions & 5 deletions server/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,11 +375,13 @@ module.exports = function() {
} else {
const context = getDefaultContext( req );

try {
context.layout = ReactDomServer.renderToString( LayoutLoggedOutDesignFactory() );
} catch ( ex ) {
if ( config( 'env' ) === 'development' ) {
throw ex;
if ( config.isEnabled( 'server-side-rendering' ) ) {
try {
context.layout = ReactDomServer.renderToString( LayoutLoggedOutDesignFactory() );
} catch ( ex ) {
if ( config( 'env' ) === 'development' ) {
throw ex;
}
}
}

Expand Down

0 comments on commit 9a681b2

Please sign in to comment.