Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved call to set the page on the response logger from #659

Merged
merged 1 commit into from
Sep 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/react-server/core/context/Navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var EventEmitter = require('events').EventEmitter,
Q = require('q'),
History = require("../components/History"),
ReactServerAgent = require("../ReactServerAgent"),
PageUtil = require("../util/PageUtil");
PageUtil = require("../util/PageUtil"),
{setResponseLoggerPage} = SERVER_SIDE ? require('../logging/response') : { setResponseLoggerPage: () => {} };

var _ = {
isFunction: require('lodash/isFunction'),
Expand Down Expand Up @@ -184,6 +185,10 @@ class Navigator extends EventEmitter {
isRawResponse : false,
});

// Set the page context on the response logger so it can figure
// out whether to flush logs to the response document
setResponseLoggerPage(page);

// call page.handleRoute(), and use the resulting code to decide how to
// respond.
// We call it in a promise handler so any exception that
Expand Down
5 changes: 1 addition & 4 deletions packages/react-server/core/renderMiddleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var logger = require('./logging').getLogger(__LOGGER__),
StringEscapeUtil = require('./util/StringEscapeUtil'),
{getRootElementAttributes} = require('./components/RootElement'),
{PAGE_CSS_NODE_ID, PAGE_LINK_NODE_ID, PAGE_CONTENT_NODE_ID, PAGE_CONTAINER_NODE_ID} = require('./constants'),
{setResponseLoggerPage, flushLogsToResponse} = require('./logging/response');
{flushLogsToResponse} = require('./logging/response');

var _ = {
map: require('lodash/map'),
Expand Down Expand Up @@ -132,9 +132,6 @@ module.exports = function(server, routes) {
return;
}
}
// Set the page context on the response logger so it can figure
// out whether to flush logs to the response document
setResponseLoggerPage(page);
renderPage(req, res, context, start, page);

});
Expand Down